mirror of
https://github.com/coreybutler/nvm-windows.git
synced 2026-01-14 07:03:17 +08:00
Avoid mixing user-environment PATH and system-environment PATH
%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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user