Windows Explorer (Open directory in command prompt preserving dir PATH) – Add Dos Prompt Here feature via tiny registry tweak

Friday, 10th January 2014

Windows explorer dos prompt here open directory in windows command line

If you have to use Windows on system administration level, you had to use command prompt daily, thus its useful to be able to be able to open Command Line starting from desired directory with no need to copy directory Path by hand and CD to it manually.

By default Command Prompt, cmd.exe always opens itself setting a path to user home directory, reading what is defined by win system variable %USERPROFILE% or %HOMEPATH% – MS Windows equivalent of UNIX's $HOME shell variable.

To add open in  DOS Prompt Here Command Prompt option to Windows Explorer menus its necessary to apply few rules to Windows registry DB
Use above Download link and launch it and from there on clicking with right Mouse button to any directory will enable you to open directory in CMD.EXE.

Here is content of little registry tweak adding the new menu Dos Prompt Here button
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOTDirectoryshellDosHere]
@="Dos &Prompt Here"

[HKEY_CLASSES_ROOTDirectoryshellDosHereCommand]
@="cmd.exe /k cd %1"

[HKEY_CLASSES_ROOTDriveshellDosHere]
@="Dos &Prompt Here"

[HKEY_CLASSES_ROOTDriveshellDosHereCommand]
@="cmd.exe /k cd %1"

Windows explorer open program files or any specific directory in windows command line

windows opening directory in command line program files screenshot win 7

This little registry code is originally for Windows 2000, anyways it is compatible with all NT technology based Windowses, Add DOS Prompt Here tweak works fine on Windows XP, Windows 7 and Windows 8 (Home, Pro and Business editions).

By Mentioning $HOME its interesting to say Windows equivalent of Linux's as it might be useful to know:

linux:~# echo $HOME
/home/hipo

is

C:\> echo %USERPROFILE%
C:\Users\georgi

To list all Windows Command Prompt environment variable equivalent to Linux's bash shell env / setenv is SET command), here is example output from my Winblows;

C:Usersgeorgi> SET
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\UsersgeorgiAppDataRoaming
CLASSPATH=.;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip
CommonProgramFiles=C:\Program FilesCommon Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=GEORGI
ComSpec=C:\Windows\system32\cmd.exe
DEFLOGDIR=C:\ProgramData\McAfee\DesktopProtection
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Users\georgi
LOCALAPPDATA=C:\Users\georgi\AppData\Local
NUMBER_OF_PROCESSORS=4
OS=Windows_NT
Path=C:\Program Files\RA2HP\;C:\Windows\system32;C:\Windows;C:\Windows\S
Wbem;C:\Windows\System32\WindowsPowerShellv1.0;C:\Program Files\WIDCOM
oth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Pr
les (x86)\Hewlett-Packard\HP ProtectTools Security Manager\Bin\;C:\Progr
\ActivIdentity\ActivClient\;C:\Program Files (x86)\ActivIdentity\ActivCl
\Program Files (x86)\QuickTime\QTSystem\
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=3a09
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0Modules\
PTSMInstallPath_X86=C:\Program Files (x86)\Hewlett-Packard\HP ProtectToo
ity Manager\
PUBLIC=C:\Users\Public
QTJAVA=C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\georgi\AppData\Local\Temp
TMP=C:\Users\georgi\AppData\Local\Temp
USERDNSDOMAIN=EMEA.CPQCORP.NET
USERDOMAIN=EMEA
USERNAME=georgi
USERPROFILE=C:\Users\georgi
VSEDEFLOGDIR=C:\ProgramData\McAfee\DesktopProtection
windir=C:\Windows
windows_tracing_flags=3
windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log

Hope this little trick hopes someone out there.
I will be glad to hear of other cool useful windows registry tweaks?

 

Share this on:

Download PDFDownload PDF

Tags: , , , , , , , , , , , , , , , , , , , , ,

One Response to “Windows Explorer (Open directory in command prompt preserving dir PATH) – Add Dos Prompt Here feature via tiny registry tweak”

  1. Gepeto says:
    Firefox 27.0 Firefox 27.0 Windows 7 x64 Edition Windows 7 x64 Edition
    Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0

    Interesting for old windows server.

    Otherwise since Windows 2008 / 7 (maybe vista ?) you just need to write “cmd” in the navigation bar. Then the command shell will open up pointing to the current directory of the explorer.

    View CommentView Comment

Leave a Reply

CommentLuv badge