How do I get a right-click command line for a folder?

17

5

I want to be able to right click on a folder called (C:\myFolder) and have a command prompt open like this...

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\myFolder>

Is this possible?

Pete2k

Posted 2014-02-27T21:01:21.297

Reputation: 713

Question was closed 2014-02-28T17:23:45.593

1besides the great answer, a workaroudn alternative solution is opening a cmd prompt and typing CD (that's C,D,space) dragging the folder to it and hitting ENTER. but the shift-right click makes more sense. and I suppose amending it so it's in the right click menu withoutt shift is even better. – barlop – 2014-02-27T23:26:47.247

1IMHO, This question is a lot more succinct and to the point. The older previous question is better candidate to be treated as duplicate. – LMSingh – 2014-02-28T22:08:57.693

Answers

44

How to open a command prompt from Windows Explorer

In previous versions of Windows like XP/2000 you needed to run TweakUI to get that from the context menu.

However since Windows 7 and 8 you simply hold Shift key when you right-click.

enter image description here

Its easy to hold Shift key when you right-click and you will have the open command window here.

enter image description here

There are numerous posts online regarding how to insert this same functionality into the default right-click context menu with registry hacks and all kinds of nonsense that will allow you to do this without the need to Shift.

I just use the shift + right click trick and move on with my life. I'd advise most end users to stay out of the registry unless they know what they're doing.

Check out this techrepublic article.

MDT Guy

Posted 2014-02-27T21:01:21.297

Reputation: 3 683

Some other also only shows up when holding shift, like "Run As..." (if I recall correctly). – Alvin Wong – 2014-02-28T14:54:30.323

When doing customer support for people that have Cerebral Palsy and other ailments, we had to learn how to do this in Windows as not everybody can use a mouse. Open Windows Explorer using either CTRL+ESC or the Windows Key.. Navigate to locate Windows Explorer.. Open the subfolders with your space bar.. Once Windows Explorer is located, Click the TAB key until you get to the correct folder.. Press SHIFT+F10 to right-click on the folder.. Move your arrow up or down and press ENTER to start.. – Leptonator – 2014-03-02T05:39:48.243

3

Shift-click works only on folders and answers the original question. However you can have the same effect even on files in all versions of Windows (NT,2000,XP and later). I've used this solution on folders and files in explorer. More importantly, it even works inside of File Selection dialogs; anywhere a windows file context menu can come up. It also does not require a registry change.

In your "SendTo" folder you can either make a batch file called "LaunchCMDAtThisFileOrFolder.Bat". The location of "SendTo" is different by Windows version. See this for XP and this for Vista & 7, 8 or this. If you like code then this might be interesting

The batch file will have the following code.

@Echo off
%~d1
CD %~dp1
CMD /K

Now you can right-click any file and "Send To" -> "LaunchCMDAtThisFileOrFolder".

Here's an example of a Standard Windows Dialog where you can use this. Note, the context menu is on a file, not a folder as it works on both.

Here's an example of a Standard Windows Dialog where I can use this. Note, the context menu is on a file, not a folder as it works on both.

Here's an example of a Non Standard Windows File Listing where this can be used.

Here's an example of a Non Standard Windows File Listing where this can be used.

CMD Prompt opened at the folder of the "SendTo" target.

How the batch file works.. Reference Windows command line help, specifically the FOR command http://www.robvanderwoude.com/allhelpw2ksp4_en.php#FOR

%~d1 translates to drive letter of the first parameter to the batch file.
CD %~dp1 translates to CD "path of the first parameter".
CMD /K runs the CMD.exe. The /K parameter is needed inside a batch file specifically, otherwise CMD.exe will automatically close.

PS: I +1'd MDT Guy's answer because I learnt a new shortcut.

References:

http://support.microsoft.com/kb/310270 http://answers.microsoft.com/en-us/windows/forum/windows_7-files/i-have-windows-7-and-cannot-locate-the-send-to/652b4c8a-e743-46c4-a554-c1c8b334ee35 http://www.howtogeek.com/howto/windows-vista/customize-the-windows-vista-send-to-menu/ http://answers.microsoft.com/en-us/windows/forum/windows_vista-desktop/how-to-locate-the-sendto-folder-in-vista/78b16711-1135-4eb0-851a-8abae9bfe9ed http://www.robvanderwoude.com/allhelpw2ksp4_en.php#FOR

LMSingh

Posted 2014-02-27T21:01:21.297

Reputation: 807

Does this work when the file is on a different drive? I think you may need the /D swtich in "CD %~dp1 /D". – RJFalconer – 2014-02-28T11:51:50.630

@RJFalconer It does because of the line.. %~d1. That results in D: or E: etc. for the file. Editing answer to explain. Thanks for your edits. – LMSingh – 2014-02-28T21:58:43.383

Ah, I see. Neat. :) – RJFalconer – 2014-02-28T22:23:30.717