Pete Freitag Pete Freitag

Right Click to Open Command Prompt in Directory

Published on July 22, 2004
By Pete Freitag
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.



windows tips productivity

Right Click to Open Command Prompt in Directory was first published on July 22, 2004.

If you like reading about windows, tips, or productivity then you might also like:

Discuss / Follow me on Twitter ↯

Comments

Wonderful tip.
by Sudhakar G on 09/28/2004 at 4:03:24 PM UTC
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.
by John on 05/17/2006 at 12:33:07 PM UTC
i need help.. i cant open cmd on this crack of a school computer that thing they are so well protected. help me
by hi on 05/24/2006 at 2:00:59 PM UTC
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.
by NGNeer on 06/09/2006 at 4:42:40 PM UTC
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!!
by Sudhanva on 06/28/2006 at 1:22:44 PM UTC
Sudhava,

Thanks a trillion ... wonderful solution!!!
by Rajib on 03/20/2007 at 4:40:31 AM UTC
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
by Antonieta on 05/05/2007 at 9:43:10 AM UTC
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.
by suman on 11/13/2007 at 9:25:53 PM UTC
How do I add an icon on the left side of the menu? Thanks in advance
by fedmich on 02/21/2008 at 8:34:12 PM UTC
Because cmd.exe is on the path, you don't really need to specify anything but "cmd.exe" in the field.
by Rick on 03/03/2008 at 9:47:50 AM UTC
how do i remove Right Click to Open Command Prompt in Directory
by sankar on 09/12/2008 at 2:00:24 AM UTC
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!!
by sankar on 09/12/2008 at 2:23:07 AM UTC
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
by Sina on 07/27/2009 at 9:44:53 PM UTC
Excellent tip.... Very useful
by Prasenjit on 11/28/2009 at 2:42:28 PM UTC
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.
by saha on 12/03/2009 at 1:06:12 AM UTC
how to delete the undeleted software use the command prompt
by jhun on 12/18/2009 at 11:53:25 PM UTC
Anybody know how to remove the "Delete" or "Rename" form the right click menu?
by Joeri on 01/07/2010 at 5:18:53 AM UTC
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
by giji_DVE on 01/15/2010 at 4:06:52 AM UTC
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.
by Terry on 04/03/2013 at 9:08:50 PM UTC