Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change default path of node.js command prompt?

Tags:

node.js

npm

Just the same as title, I want to change the default path of node.js command prompt from c:\user\"my username" to C:\nodejs, but not to affect that one(I mean default path) of windows command prompt.

Does anyone know if it is possible?

Node.js command prompt default path pic

like image 231
mizok Avatar asked Dec 31 '25 19:12

mizok


1 Answers

Yes, it is possible to change default path of node.js command prompt, when you launch it, then (Windows case)

  1. go the directory where NodeJS was installed
  2. find file nodevars.bat
  3. open it with editor as administrator
  4. 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/"

if you mean to change directory once when you launched "Node.js command prompt", then execute the following command in the Node.js command prompt:

     cd c:/MyDirectory/
like image 159
Roman Avatar answered Jan 03 '26 09:01

Roman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!