Skip to content
This repository
Browse code

windows: fix/improve nodejsvars.bat

- Fix: it didn't work for the x86 version of node
- Also add NPM to path
- Also print node version
- Don't change dir to home dir if not started from the start menu
  • Loading branch information...
commit 3bab12197fe6d25f1bd0f40d5e5e83ad0d9276c8 1 parent de89bbb
Bert Belder piscisaureus authored

Showing 1 changed file with 10 additions and 7 deletions. Show diff stats Hide diff stats

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

0 comments on commit 3bab121

Please sign in to comment.
Something went wrong with that request. Please try again.