Right Click to Open Command Prompt in Directory

July 22, 2004
misc

Here's a handy tip that I got from a co-worker, who found it in the book Microsoft Visual C# .NET Step by Step. It creates a shortcut in the right click context menu of Windows Explorer to open a command prompt in the current directory. When I need to run scripts in a very long directory name, this is very handy.

So here's how you set it up:

  • Open up windows explorer
  • Tools -> Folder Options.
  • File Types Tab
  • Select the Folder file type
  • Click Advanced
  • Click New
  • For the Action type what ever you want the context menu to display, I used Command Prompt.
  • For the Application used to perform the action use c:\windows\system32\cmd.exe (note on win2k you will want to specify the winnt directory instead of the windows directory)

You can also use this feature to attach context actions to file types. Or if you want to create a right click open with option for any file type (for instance I like to be able to open any file with notepad, see: my blog entry here.


Like this? Follow me ↯


You might also like:

32 people found this page useful, what do you think?

Comments

Wonderful tip.
I did this and now I cant disable it or delete the entry in the advanced tab. All of my files attempt to open with cmd.exe. I cant change the default back to "open". HELP.
i need help.. i cant open cmd on this crack of a school computer that thing they are so well protected. help me
Very useful indeed. I wrote a complimentary shell extension for those cases where you're already inside the directory you want the command prompt to start in, but you don't want to have to go up one level just to right-click the folder. It's called BackgroundCMD, and it lets you start cmd.exe from the context menu of the folder background. It's also good for start cmd.exe from the desktop, without having to go to your user folder under "C:\Documents and Settings". http://www.roggel.com/NGNeer/BackgroundCMD Regards, NGNeer.
I did this and now I cant disable it or delete the entry in the advanced tab. All of my files attempt to open with cmd.exe. I cant change the default back to "open". Can anyone plz tell me how could i remove this option.. HELP!!
Sudhava, Thanks a trillion ... wonderful solution!!!
Hi: i have a problem with open any folder, the "open" option is tha last of the tree when i right click, the default option is "search", so everytime i tried to open a folder, the search windows display. I even tried to change from the filetypes list in the toolbar, but doesn't appear the "open" option, only "find" (that is bolded). Please help me, because it's awful work like this. P.D: excuse my poor english, i don't speak it well
hi everybody, To open a command prompt from the right click menu manually,as everybody said i could not find the directory [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell in my system.i could find upto [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder thats it.can any body celar my doubt.
How do I add an icon on the left side of the menu? Thanks in advance
Because cmd.exe is on the path, you don't really need to specify anything but "cmd.exe" in the field.
how do i remove Right Click to Open Command Prompt in Directory
I did this and now I cant disable it or delete the entry in the advanced tab. All of my files attempt to open with cmd.exe. I cant change the default back to "open". Can anyone plz tell me how could i remove this option.. HELP!!
hi i a question for get get selected directory name in vb.net or c#.net i add an item to right click folder with folder/shell and ... but i want get selected folder name in application time user do right click on the a folder and select my item thank you
Excellent tip.... Very useful
anyone who have problem to change back to normal please use this tip it will help you.
-goto run then type regedit
-goto hkey_classes_root->directory->shell
-modified the default data value to "none"
-then finish.
how to delete the undeleted software use the command prompt
Anybody know how to remove the "Delete" or "Rename" form the right click menu?
Is there any method to retrieve the name of selected folder in Windows Explorer in C#?
I need to read the files in the selected folder, for that I have to find out the name of the selected folder.

Please Help
How do I remove Command Promt from ... EVERY THING now that asks for it. I have no idea what I did to get it there but it is annoying and I don't know what to tell the damned thing. I messed around by accident and found if I used the 'explore' option it would allow me to see what's in a folder.


Foundeo Inc.