How can I change the directory that I'm in when I open node.js command prompt in Windows?
This question was asked before, but it was 5 years ago and the solution given does not work for me.
Here is the solution given in the last question:
- go the directory where NodeJS was installed
- find file nodevars.bat
- open it with editor as administrator
change the default path in the row which looks like
if "%CD%\"=="%~dp0" cd /d "%HOMEDRIVE%%HOMEPATH%"
with your path. It could be for example
if "%CD%\"=="%~dp0" cd /d "c://MyDirectory/"
I did not find nodevars.bat where i expected it (as per point 1 above). So I did a PC-wide search and all that turned up was in C:\Users\pieka\AppData\Roaming\nvm\v8.11.4
("pieka" is my user name).
This may have something to do with the less widely used node version manager for windows that I have installed - I am not sure.
More importantly, I edited nodevars.bat
as per the answer, but my start-up directory remains unchanged when I open node.js command prompt.
I also found this question, but it relates to Windows Command prompt, and to be honest I am not sure where to insert the code (IF /I x"%COMSPEC%"==x%CMDCMDLINE% (cd /D c:\)
) that it suggests. Does the nodejs command prompt mimick the windows command prompt in terms starting directory?
Could I also achieve what I want by "opening" node.js command prompt from somewhere else than from the start menu?