pf » Right Click to Open Command Prompt in Directory

Right Click to Open Command Prompt in Directory

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.



Related Entries
17 people found this page useful, what do you think?

Trackback Address: 146/32E960656FC81573A9EB5C30A7F8153A
On 07/23/2004 at 7:49:32 AM MDT ziller wrote:
1
take a look at http://www.terabyteunlimited.com/downloads/DOSDROP.ZIP

it's free and so easy ;-)

On 07/28/2004 at 1:29:19 PM MDT finn wrote:
2
XP Powertoys adds that too.. http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx

On 09/28/2004 at 4:03:24 PM MDT Sudhakar G wrote:
3
Wonderful tip.

On 01/20/2005 at 11:20:41 PM MST jacqui wrote:
4
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!

On 02/07/2005 at 2:12:31 AM MST azhou wrote:
5
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

On 10/27/2005 at 3:38:32 PM MDT Sanjeev Parasar wrote:
6
Command Prompt

On 04/22/2006 at 6:30:10 PM MDT meena wrote:
7
this is a very useful thing to have thanks for the clear explanation

On 05/17/2006 at 12:33:07 PM MDT John wrote:
8
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.

On 05/24/2006 at 2:00:59 PM MDT hi wrote:
9
i need help.. i cant open cmd on this crack of a school computer that thing they are so well protected. help me

On 06/09/2006 at 4:42:40 PM MDT NGNeer wrote:
10
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.

On 06/28/2006 at 1:22:44 PM MDT Sudhanva wrote:
11
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!!

On 06/28/2006 at 1:51:11 PM MDT Sudhanva wrote:
12
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!!!

On 07/06/2006 at 4:27:39 AM MDT Sony wrote:
13
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.

On 07/12/2006 at 10:01:52 AM MDT Dez wrote:
14
Yeah I screwed this up to, thaks for the solution too!

On 07/17/2006 at 11:22:34 AM MDT Corey wrote:
15
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.

On 11/07/2006 at 2:05:24 PM MST DeathWalker wrote:
16
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...

On 11/23/2006 at 6:40:24 PM MST potatoes wrote:
17
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"

On 12/06/2006 at 5:45:11 PM MST mikew909 wrote:
18
nice mate, that helped me out with another problem cheers!

On 12/11/2006 at 2:33:11 AM MST haresh wrote:
19
tx for the tip very helpfull save time...

On 01/11/2007 at 6:30:46 AM MST marech wrote:
20
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\""

On 02/04/2007 at 1:13:54 AM MST Raj wrote:
21
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.

On 03/16/2007 at 9:31:41 AM MST Kyle wrote:
22
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

On 03/16/2007 at 9:32:33 AM MST Kyle wrote:
23
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

On 03/20/2007 at 4:40:31 AM MST Rajib wrote:
24
Sudhava,

Thanks a trillion ... wonderful solution!!!

On 03/28/2007 at 5:30:52 PM MST ME wrote:
25
All my drives want to open in cmd.exe now! I tried the thing above but it didn't help! Can Someone HELP ME?

On 03/28/2007 at 5:59:44 PM MST ME wrote:
26
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

On 05/05/2007 at 9:43:10 AM MDT Antonieta wrote:
27
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

On 07/24/2007 at 6:22:58 AM MDT Peter Parker wrote:
28
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/

On 10/14/2007 at 11:11:22 PM MDT cowblisdom wrote:
29
hey,birds,try this, http://www.ktechcomputing.com/cmdopen/

On 11/13/2007 at 9:25:53 PM MST suman wrote:
30
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.

On 02/16/2008 at 1:48:27 AM MST Naomi wrote:
31
Thanks heaps for this advice - took me a couple of tries, but I got it in the end.

-Naomi

On 02/21/2008 at 8:34:12 PM MST fedmich wrote:
32
How do I add an icon on the left side of the menu? Thanks in advance

On 03/03/2008 at 9:47:50 AM MST Rick wrote:
33
Because cmd.exe is on the path, you don't really need to specify anything but "cmd.exe" in the field.

On 04/23/2008 at 8:31:59 AM MDT greenie wrote:
34
Sudhanva--You da best. Thanks for the instructions on how to delete the pesky right-click Command prompt.

On 04/25/2008 at 7:01:25 PM MDT Anonymous wrote:
35
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.




  



Spell Checker by Foundeo





Subscribe to my RSS Feed: solosub RSS
Tags