July 22, 2004
Right Click to Open Command Prompt in Directory
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.
Related Entries
17 people found this page useful, what do you think?
Trackback Address: 146/32E960656FC81573A9EB5C30A7F8153A
take a look at http://www.terabyteunlimited.com/downloads/DOSDROP.ZIP
it's free and so easy ;-)
XP Powertoys adds that too.. http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx
Awesome tip on the "right click to open command prompt in directory"... very nice... i also used the tip about right clicking to notepad... extremely useful.. thanks a million!
how to add right click for creating new folder at tree list (i.e. left column of explorer, similar to acdsee 2.4 / 3.0 that you can add folder at any visible folder, saving lots of clicks and stupid layered selection); accordingly how to add an icon at explorer to create folder? I'm using win98, me, 2000 and nt
this is a very useful thing to have thanks for the clear explanation
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!!
hi John, I myself faced the same problem like you. And then after rigorous googling I found the solution. Hope this will help u out.. With your backup in place, select Start, Run, type regedit, double-click HKEY_CLASSES_ROOT.To trim items from the right-click menu for folders, navigate the tree diagram on the left to HKEY_CLASSES_ROOT\Directory\shell. Double-click shell to see additional keys. Each key corresponds to one command on the right-click menu for folders. You won't see Windows' built-in commands for folders (you can't remove those); but you should see folders for commands that have been added by YOU or other applications. Now delete the folder that corresponds to the Command Prompt.. Now you are done!!!
Thank u so much Sudhanva.Me also had same trouble of opening all the files and folders with cmd.exe.I was searching the net for a solution and found ur post.Thank u.
Yeah I screwed this up to, thaks for the solution too!
I didnt even do anything, and this happened to my folders and drives - thanks to your info sudhavna, i figured it out. Thanx so much.
hi ppl i have a problem me problem is i need the exact line command to open folders but inside folders i mofiqued the shell on xp and now open folders in new windows this is the big problem to me imagine...
1. Open regedit 2. Navigate to HKEY_LOCAL_MACHINE/Software/Classes/Folder/Shell 3. Create a new key called Command Prompt 4. Your default value should be Command Prompt Here 5. Create a new key called Command under the Command Prompt key 6. Your default value should be cmd.exe /k pushd %L
Your popup menu when you right click on a folder will now contain an option called Command Prompt Here which will open a command prompt in the selected folder.
i use cmd.exe /k "cd %L" or cmd.exe /k cd %1.
see here http://support.microsoft.com/kb/320148
i made this like this in windows explorer (eu fiz assim no windows explorer) folder options (opções de pastas) find the directory (ache pasta de arquivos) duble click-> advanced -> new , put the name you want (dois click-> avandado-> novo, coloca o nome que quiser) in the value put this: cmd.exe /k "cd %L"
(na valor coloca isso filho: cmd.exe /k "cd %L"
nice mate, that helped me out with another problem cheers!
tx for the tip very helpfull save time...
I was looking for that and found it, very good tip. i used the regedit way: --- Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Command prompt] @="Command prompt" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Command prompt\command] @="cmd.exe /k \"cd %L\""
Thank u soooooooo much Sudhanva.Me also had trouble of opening all the files and folders with Print folder listing. I was searching the net for a solution and found ur post.Thank u.
Every time I try to open a folder up pops the command prompt and I can't open my folder. I have to right click and then click open in the drop down menu to open my folders. My files open fine, but my folders won't. I NEED HELP. Thanks to anyone who can give it to me.
Kyle
Every time I try to open a folder up pops the command prompt and I can't open my folder. I have to right click and then click open in the drop down menu to open my folders. My files open fine, but my folders won't. I NEED HELP. Thanks to anyone who can give it to me.
Kyle
Sudhava,
Thanks a trillion ... wonderful solution!!!
All my drives want to open in cmd.exe now! I tried the thing above but it didn't help! Can Someone HELP ME?
I got it. I found it here: http://www.onecomputerguy.com/registry_tips.htm#doswindow Add or Edit the following Registry Keys [HKEY_CLASSES_ROOT\Directory\shell\opennew] @="Dos Prompt in that Directory" [HKEY_CLASSES_ROOT\Directory\shell\opennew\command] @="command.com /k cd %1" [HKEY_CLASSES_ROOT\Drive\shell\opennew] @="Dos Prompt in that Drive" [HKEY_CLASSES_ROOT\Drive\shell\opennew\command] @="command.com /k cd %1" These will allow you to right click on either the drive or the directory and the option of starting the dos prompt there will pop up I needed to go to drive not directory
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
To fix that annoying "get search on double-click":
http://www.howtogeek.com/howto/windows/how-to-fix-double-click-always-opens-search-in-windows-explorer/
hey,birds,try this, http://www.ktechcomputing.com/cmdopen/
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.
Thanks heaps for this advice - took me a couple of tries, but I got it in the end.
-Naomi
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.
Sudhanva--You da best. Thanks for the instructions on how to delete the pesky right-click Command prompt.
how to remove the action type I created? I had mistakenly create the prompt action to "file folder" type, now when I try to double click on a folder to open it, it instead try to do the "search" for me.