Sometimes I want to open a command prompt to a certain folder. In my example, I want to open a CMD prompt to the folder Downloads on my E drive. I could just open up CMD prompt that defaults to C:\Users\Terry and then navigate to E:\Downloads. I could also download a registry tweak to have it as a right-click Context menu option.
If you don’t want to fool around with a REG file, there is still another way to do it. Just open up File Explorer to the folder of your choice. In the explorer bar across the top where the path is displayed is, in my case, This PC > back1 (E:) > Downloads.
If I click in that bar it changes the display slightly, as in my case E:\Downloads. You can also see it’s highlighted.
Now I just type cmd.
Then I just hit enter and the cmd prompt opens at the folder I specified.
Registry Tweak
[message type=”warning”] Standard Registry Editing Warning: The following instructions will ask you to edit your Windows Registry. Be sure to make a backup of your Registry before you make any changes. Making mistakes in the Registry can cause hard-to-diagnose problems, or even keep Windows from functioning properly. If you don’t know how to back up your Registry, please read Windows Quick Tips – Backup/Restore Registry. [/message]
If you want the registry tweak to add the option to your Context menu, just copy and paste the following into a text (Notepad) file and change the extension to reg. Depending on your editor, change the file type from txt to “all file types”.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\cmd2]
@=”@shell32.dll,-8506″
“Extended”=-
“Icon”=”imageres.dll,-5323”
“NoWorkingDirectory”=””
[HKEY_CLASSES_ROOT\Directory\shell\cmd2\command]
@=”cmd.exe /s /k pushd \”%V\””
[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd2]
@=”@shell32.dll,-8506″
“Extended”=-
“Icon”=”imageres.dll,-5323”
“NoWorkingDirectory”=””
[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd2\command]
@=”cmd.exe /s /k pushd \”%V\””
[HKEY_CLASSES_ROOT\Drive\shell\cmd2]
@=”@shell32.dll,-8506″
“Extended”=-
“Icon”=”imageres.dll,-5323”
“NoWorkingDirectory”=””
[HKEY_CLASSES_ROOT\Drive\shell\cmd2\command]
@=”cmd.exe /s /k pushd \”%V\””
[HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\cmd2]
@=”@shell32.dll,-8506″
“Extended”=-
“Icon”=”imageres.dll,-5323”
“NoWorkingDirectory”=””
[HKEY_CLASSES_ROOT\LibraryFolder\Background\shell\cmd2\command]
@=”cmd.exe /s /k pushd \”%V\””
(Ed note: If you see “ instead of an opening quotation mark, replace it with an open quote. This is a WordPress flaw and we can’t change this weird behavior. If you don’t make this change, then the reg file you create won’t work. For you convenience, I have added this download link. UnZIP the file. I tested this and it worked perfectly.)
Once your reg file is created, double-click on it and accept all prompts. If it doesn’t show up right away, restart your system. In my case, I didn’t need a restart.
—
Hi, Great tip, never knew this! One question though, most of the time when I need to use the command prompt, I need to run it as administrator. Is there anyway to to that with these tips?
Thanks!
Sorry, I’m not aware of any way to do it now as an administrator. If I come across anything I’ll let you know.
Peter,
If it’s any help, you can open an elevated PowerShell to any folder: Navigate to the folder, click File (in the menu across the top), hover the mouse cursor over the Open Windows PoweShell option and then click Open Windows PowerShell as administrator.
Thanks, another cool trick!