nodevars.bat 678 B

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