Click here to Skip to main content
12,407,037 members (62,521 online)
Click here to Skip to main content
Add your own
alternative version

Stats

24.7K views
319 downloads
20 bookmarked
Posted

Open cmd.exe from Explorer

, 18 Apr 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
Open a cmd console from almost anywhere in Explorer via context menu

Files.png

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

Introduction

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.

OpenContetxtMenu_OnFolder.png

On a Folder or drive

OpenContetxtMenu_OnFile.png

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.

CmdShellExtention_v1

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

[HKEY_CLASSES_ROOT\*\Shell\OpenPrompt] 
@="Command Prompt" 

[HKEY_CLASSES_ROOT\*\Shell\OpenPrompt\Command] 
@="cmd.exe /d cd %l" 

[HKEY_CLASSES_ROOT\Folder\Shell\OpenPrompt] 
@="Command Prompt" 

[HKEY_CLASSES_ROOT\Folder\Shell\OpenPrompt\Command] 
@="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

[-HKEY_CLASSES_ROOT\*\Shell\OpenPrompt]

[-HKEY_CLASSES_ROOT\Folder\Shell\OpenPrompt]

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.

History

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

License

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

Share

About the Author

kim.david.hauser
Software Developer (Senior)
Switzerland Switzerland
programmer and software junkie since 1991 zurich switzerland

You may also be interested in...

Comments and Discussions

 
GeneralMy vote of 1 Pin
Munim Abdul21-Apr-10 20:51
memberMunim Abdul21-Apr-10 20:51 
QuestionCan be done directly in Tools/Options Pin
Dan Buskirk20-Apr-10 0:07
memberDan Buskirk20-Apr-10 0:07 
GeneralPowertoys Pin
SandyM19-Apr-10 22:42
memberSandyM19-Apr-10 22:42 
GeneralPowerShell Pin
leal8519-Apr-10 8:30
memberleal8519-Apr-10 8:30 
GeneralRe: PowerShell Pin
leal8520-Apr-10 8:15
memberleal8520-Apr-10 8:15 
Generalnot working Pin
Member 448543019-Apr-10 2:10
memberMember 448543019-Apr-10 2:10 
GeneralWindows 7 Pin
TL Wallace18-Apr-10 14:21
memberTL Wallace18-Apr-10 14:21 
GeneralRe: Windows 7 Pin
brianhama19-Apr-10 18:06
memberbrianhama19-Apr-10 18:06 
Generalalternative Pin
afriza18-Apr-10 11:57
memberafriza18-Apr-10 11: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.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160730.1 | Last Updated 18 Apr 2010
Article Copyright 2010 by kim.david.hauser
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid