mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 23:43:09 +01:00
922d53897d
This commit fixes an issue with the Node.js command prompt on Windows where the PATH environment variable would not be set correctly if the existing PATH contained an '&'. Fixes: https://github.com/nodejs/node/issues/4802 PR-URL: https://github.com/nodejs/node/pull/4804 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
25 lines
678 B
Batchfile
25 lines
678 B
Batchfile
@echo off
|
|
|
|
rem Ensure this Node.js and npm are first in the PATH
|
|
set "PATH=%APPDATA%\npm;%~dp0;%PATH%"
|
|
|
|
setlocal enabledelayedexpansion
|
|
pushd "%~dp0"
|
|
|
|
rem Figure out the Node.js version.
|
|
set print_version=.\node.exe -p -e "process.versions.node + ' (' + process.arch + ')'"
|
|
for /F "usebackq delims=" %%v in (`%print_version%`) do set version=%%v
|
|
|
|
rem Print message.
|
|
if exist npm.cmd (
|
|
echo Your environment has been set up for using Node.js !version! and npm.
|
|
) else (
|
|
echo Your environment has been set up for using Node.js !version!.
|
|
)
|
|
|
|
popd
|
|
endlocal
|
|
|
|
rem If we're in the Node.js directory, change to the user's home dir.
|
|
if "%CD%\"=="%~dp0" cd /d "%HOMEDRIVE%%HOMEPATH%"
|