Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
I followed your steps, and am able to successfully test the console.log as you did. But, commands like dir and cd do not work. I think that the repl may be opening instead of the command prompt. –  edt Oct 10 '13 at 23:51
    
Then you need to explain "the Node command prompt". If you want commands like dir and cd why is the normal command prompt not sufficient? How do you normally start this "Node command prompt"? –  Rik Oct 11 '13 at 4:37
    
The node command prompt is similar to the normal command prompt, but gives you the added capability of running node apps with the command "node [path/to/app].js". The node command prompt is installed by default when you install node on Windows. Here is a somewhat related SO question: stackoverflow.com/questions/17654610/… –  edt Oct 11 '13 at 14:43
    
I think you misunderstood that post. There is nothing named "Node command prompt". You can start 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. –  Rik Oct 11 '13 at 16:06
    
Yes, I do get a "'node' is not a recognized..." message when I try to run a program from the normal command prompt. Just so I understand about the Node Command Prompt, do you mean that when I choose Start -> Programs -> Node.js -> Node Command Prompt, that I am actually opening the normal command prompt in disguise? –  edt Oct 11 '13 at 16:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.