Skip to content

Commit

Permalink
Avoid mixing user-environment PATH and system-environment PATH
Browse files Browse the repository at this point in the history
%PATH% expands to the system plus the user variables,
so if user defined user-environment PATH, 'setx /M PATH "%PATH%;..."'
mixes user-environment PATH and system-environment PATH.
  • Loading branch information
tomisawk committed May 16, 2018
1 parent a175c59 commit 238992a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bin/install.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ set NVM_HOME=%NVM_PATH%
set NVM_SYMLINK=C:\Program Files\nodejs
setx /M NVM_HOME "%NVM_HOME%"
setx /M NVM_SYMLINK "%NVM_SYMLINK%"
setx /M PATH "%PATH%;%NVM_HOME%;%NVM_SYMLINK%"

for /f "skip=2 tokens=2,*" %%A in ('reg query "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" /v Path 2^>nul') do (
setx /M PATH "%%B;%%NVM_HOME%%;%%NVM_SYMLINK%%"
)

if exist "%SYSTEMDRIVE%\Program Files (x86)\" (
set SYS_ARCH=64
Expand Down

0 comments on commit 238992a

Please sign in to comment.