For example, you can open a Windows Command Prompt in any folder with the shortcut:
- Shift key + right-click
Is there any similar shortcut available to open the Node command prompt in any folder?
There is no built-in way to do this. But you can create one for the right-click of a folder (just like the "Open command prompt here" examples on the internet).
Create a file named Open Node-prompt here.reg and double click it (and click Yes and OK):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Node]
@="Open Node here"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Node\command]
@="cmd.exe /s /k \"pushd \"%V\" & \"C:\\Program Files\\nodejs\\nodevars.bat\"\""
This will start the normal (cmd.exe) prompt in the correct chosen directory with first setting all the necessary variables for node.exe. After doing the dirs and cds you can call your node program.js just like normal.
dir and cd why is the normal command prompt not sufficient? How do you normally start this "Node command prompt"?
node.exe with a parameter of a .js program. You can do this from the normal command prompt (You see the cmd.exe in the title bar in that post). If you want dir and cd commands you just drop in the Command prompt (with the Shift+Right-click) and run node program.js. The problem is probably that in the Shift+Right-click cmd.exe the path to node.exe is not set (you'll get a 'node' is not recognized as an internal ...etc). If that's the case let me know. We can fix that.
Press Alt + D then type cmd and hit enter
This will open cmd in your current folder, in case anybody is looking for an alternate method.
The cmd for windows is same as the one node uses. I have tested with node commands. Thanks Rik (in comments) for the info.