Click here to Skip to main content
15,565,403 members
Articles / Operating Systems / Windows 7
Posted 18 Apr 2010


20 bookmarked

Open cmd.exe from Explorer

Rate me:
Please Sign up or sign in to vote.
4.00/5 (11 votes)
18 Apr 2010CPOL1 min read
Open a cmd console from almost anywhere in Explorer via context menu


(The installer and uninstaller registry script - content of the download)


Did you ever want to open a cmd console directly from a folder in Windows Explorer. Nothing easier than that, but you need to Help Windows a little bit first. To do so, you can use two registry entries under HKEY_CLASSES_ROOT and you come up with a context menu entry to open a console window from right where you are in Explorer.


On a Folder or drive


On a file

The solution works for 'right click' on files, folders, drives and some special folders like "Shared Documents" or "My Documents". It does not work for "Recycler", "Network", "System" and so on.


Using the Code

The tool comes with two registry scripts - an installer and an uninstaller script so you easily can remove the extension from the registry if needed.

Installing the Extension

Here you see the content of the installer script (CmdShellExtention_Install.reg):

Windows Registry Editor Version 5.00

@="Command Prompt" 

@="cmd.exe /d cd %l" 

@="Command Prompt" 

@="cmd.exe /d cd %l" 

Uninstalling the Extension

And here is the content of the script for uninstalling the extension (CmdShellExtention_UnInstall.reg):

Windows Registry Editor Version 5.00



That's the trick! Simple but handy. And all without writing a DLL for a shell extension.

Vista and Windows 7

Try "/t":

@="cmd.exe /t cd %l"  

instead of "/d":

@="cmd.exe /d cd %l"

Points of Interest

With these registry entries, you can easy create various types of simple but powerful automation from within the Windows Explorer context menu.


  • April 18. 2010 - Version 1.0
    • Initial release with support for click on files, folders, drives and some special folders


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer (Senior)
Switzerland Switzerland
programmer and software junkie since 1991 zurich switzerland

Comments and Discussions

Questioncmd.exe file error Pin
rajan12011-Oct-18 1:24
rajan12011-Oct-18 1:24 
GeneralMy vote of 1 Pin
Munim Abdul21-Apr-10 21:51
Munim Abdul21-Apr-10 21:51 
QuestionCan be done directly in Tools/Options Pin
Dan Buskirk20-Apr-10 1:07
Dan Buskirk20-Apr-10 1:07 
GeneralPowertoys Pin
SandyM19-Apr-10 23:42
SandyM19-Apr-10 23:42 
GeneralPowerShell Pin
fabrice.leal19-Apr-10 9:30
fabrice.leal19-Apr-10 9:30 
GeneralRe: PowerShell Pin
fabrice.leal20-Apr-10 9:15
fabrice.leal20-Apr-10 9:15 
Generalnot working Pin
Member 448543019-Apr-10 3:10
Member 448543019-Apr-10 3:10 
GeneralWindows 7 Pin
Terence Wallace18-Apr-10 15:21
Terence Wallace18-Apr-10 15:21 
GeneralRe: Windows 7 Pin
brianhama19-Apr-10 19:06
brianhama19-Apr-10 19:06 
Generalalternative Pin
afriza18-Apr-10 12:57
afriza18-Apr-10 12:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.