'Command Prompt Here' on Explorer Context Menu

Published on
14,998 Points
5 Endorsements
Last Modified:
Community Pick
Programmers and system administrators often find it necessary to get to a command prompt (a "DOS box") in a certain directory.  This article describes how to set up a context menu for Windows Explorer to do that.   When finished with these simple steps, you will be able to right-click any folder name in the Explorer, select Command Prompt here... and begin entering commands in a DOS box with the selected directory having been set as desired.
Context Menu for ExplorerGets to DOS prompt easily


In any Windows Explorer, select Tools / Folder Options... and click the File Types tab.Folder Options


Scroll down to find the Folder entry -- the Extension is "(None)"  Click it and then click the [Advanced] button.


In the Edit File Type dialog, click [New...]


In the New Action dialog, click fill in the values:
       Action: Command Prompt here...
Application: Cmd.ExeNew Action


OK the the New Action input, OK the Edit File Types box, and OK the Folder Options dialog.  You are done.
The Context Menu change will take effect immediately.  Use the Windows Explorer to drill-down to any depth of folder on any disk.  Right-click the folder and select Command Prompt here.

Some notes:  
If you select a virtual folder, the "current directory" may well be one that you have never seen "naked" before.  For instance, the "My Documents" folder ends up in the correct user's "Documents and Settings" folder.
If you later try to remove the new Context Menu item, you may find that the "Remove" button is not enabled.  You may need to go to the registry to make changes.  You could use RegEdit to modify the EditFlags of the Folder settings in
But I'd not recommend that.   Instead, just locate the subkey that we created...
and remove it entirely.
If you don't want to do all of those manual steps, you can add the Context Menu item using a registry file.  Just copy the following snippet to a text file named, for instance, CmdHere.reg then double click it.
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Folder\shell\Command_Prompt_Here] @="Command Prompt Here" [HKEY_CLASSES_ROOT\Folder\shell\Command_Prompt_Here\command] @="Cmd.Exe \"%1\""
I recently learned that Windows Vista has a built-in (though not well known) ability to do exactly what this article describes.  With Vista, if you press the SHIFT key while right-clicking a folder, then an "Open Command Window Here" item is added to the context menu.  Thanks to evilrix for that tip!

If you liked this article and want to see more from this author,  please click the Yes button near the:
      Was this article helpful?
label that is just below and to the right of this text.   Thanks!
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=   Dan Rollins
Ask questions about what you read
If you have a question about something within an article, you can receive help directly from the article author. Experts Exchange article authors are available to answer questions and further the discussion.
Get 7 days free