Adding Directory to PATH without Reboot or Logoff/Logon

To add “C:\New Directory” to the Path variable temporarily, i.e. for current cmd session:

set path=%path%;C:\New Directory

To add the same directory to the Path user variable:

setx path "%path%;C:\New Directory"

This command updates the Path value under the HKEY_CURRENT_USER\Environment key in the Registry.

Note the “x” in the name of the command: “setx“, not “set”.

To add the directory to the Path system variable:

setx path "%path%;C:\New Directory" /M

This command updates the Path value under the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment key.

Note the “/M” parameter.