1@echo off 2 3rem Ensure this Node.js and npm are first in the PATH 4set "PATH=%APPDATA%\npm;%~dp0;%PATH%" 5 6setlocal enabledelayedexpansion 7pushd "%~dp0" 8 9rem Figure out the Node.js version. 10set print_version=.\node.exe -p -e "process.versions.node + ' (' + process.arch + ')'" 11for /F "usebackq delims=" %%v in (`%print_version%`) do set version=%%v 12 13rem Print message. 14if exist npm.cmd ( 15 echo Your environment has been set up for using Node.js !version! and npm. 16) else ( 17 echo Your environment has been set up for using Node.js !version!. 18) 19 20popd 21endlocal 22 23rem If we're in the Node.js directory, change to the user's home dir. 24if "%CD%\"=="%~dp0" cd /d "%HOMEDRIVE%%HOMEPATH%" 25