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

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.


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