I want to move to another directory in Node.js command prompt but when I open the Node.js cmd window it doesn't show me any path. Here is the screenshot of the Node.js cmd window:
![](https://www.manongdao.com/static/images/pcload.jpg)
Now if i want to change directory to D:\abc
then how can i do it here?
That isn't the Node.js command prompt window. That is a language shell to run JavaScript commands, also known as a REPL.
In Windows, there should be a Node.js command prompt in your Start menu or start screen:
![](https://www.manongdao.com/static/images/pcload.jpg)
Which will open a command prompt window that looks like this:
![](https://www.manongdao.com/static/images/pcload.jpg)
From there you can switch directories using the cd
command.
If you mean to change default directory for "Node.js command prompt", when you launch it, then (Windows case)
- 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/"
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/
To switch to the another directory
process.chdir("../");
Type .exit in command prompt window, It terminates the node repl.