Command Prompt and PowerShell Here with Console.exe
August 11, 2010 4 Comments
In antediluvian turn of the century days, there was an Open Command Window Here PowerToy. When Vista was released, this functionality was baked in to the default Explorer shell. Hold {SHIFT} and right-click on a drive, directory or the background of a directory and you will have an “Open command window here” option in the resulting context menu. Although PowerShell is installed by default on Windows 7, there is no parallel “Open PowerShell window here” option, but it can be easily added.
“Open PowerShell window here”
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\powershell] @="Open PowerShell window here" "Extended"="" [HKEY_CLASSES_ROOT\Directory\shell\powershell\command] @="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'" [HKEY_CLASSES_ROOT\Directory\Background\shell\powershell] @="Open PowerShell window here" "Extended"="" [HKEY_CLASSES_ROOT\Directory\Background\shell\powershell\command] @="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'" [HKEY_CLASSES_ROOT\Drive\shell\powershell] @="Open PowerShell window here" "Extended"="" [HKEY_CLASSES_ROOT\Drive\shell\powershell\command] @="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"
Use Console.exe Windows
If you use command-line a lot in Windows, you will appreciate the advantages of using console.sf.net as the terminal window. The “Open … window here” context menus can be tweaked to open the new command prompts in Console rather than vanilla Windows CSRSS console windows.
"Open command window here” with Console
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\cmd] @="@shell32.dll,-8506" "Extended"="" "NoWorkingDirectory"="" [HKEY_CLASSES_ROOT\Directory\shell\cmd\command] @="\"C:\\Program Files\\Console2\\Console.exe\" -r cmd.exe -d \"%V\" -w \"Command Prompt\"" [HKEY_CLASSES_ROOT\Directory\Background\shell\cmd] @="@shell32.dll,-8506" "Extended"="" "NoWorkingDirectory"="" [HKEY_CLASSES_ROOT\Directory\Background\shell\cmd\command] @="\"C:\\Program Files\\Console2\\Console.exe\" -r cmd.exe -d \"%V\" -w \"Command Prompt\"" [HKEY_CLASSES_ROOT\Drive\shell\cmd] @="@shell32.dll,-8506" "Extended"="" "NoWorkingDirectory"="" [HKEY_CLASSES_ROOT\Drive\shell\cmd\command] @="\"C:\\Program Files\\Console2\\Console.exe\" -r cmd.exe -d \"%V\" -w \"Command Prompt\""
“Open PowerShell window here” with Console
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\powershell] @="Open PowerShell window here" "Extended"="" [HKEY_CLASSES_ROOT\Directory\shell\powershell\command] @="\"C:\\Program Files\\Console2\\Console.exe\" -r C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -d \"%V\"" [HKEY_CLASSES_ROOT\Directory\Background\shell\powershell] @="Open PowerShell window here" "Extended"="" [HKEY_CLASSES_ROOT\Directory\Background\shell\powershell\command] @="\"C:\\Program Files\\Console2\\Console.exe\" -r C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -d \"%V\"" [HKEY_CLASSES_ROOT\Drive\shell\powershell] @="Open PowerShell window here" "Extended"="" [HKEY_CLASSES_ROOT\Drive\shell\powershell\command] @="\"C:\\Program Files\\Console2\\Console.exe\" -r C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -d \"%V\""
Restore Defaults
For PowerShell, remove the powershell keys from beneath HKCR\Directory\shell, HKCR\Directory\Background\shell and HKCR\Drive\shell.
“Open command window here” restore default
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\cmd] @="@shell32.dll,-8506" "Extended"="" "NoWorkingDirectory"="" [HKEY_CLASSES_ROOT\Directory\shell\cmd\command] @="cmd.exe /s /k pushd \"%V\"" [HKEY_CLASSES_ROOT\Directory\Background\shell\cmd] @="@shell32.dll,-8506" "Extended"="" "NoWorkingDirectory"="" [HKEY_CLASSES_ROOT\Directory\Background\shell\cmd\command] @="cmd.exe /s /k pushd \"%V\"" [HKEY_CLASSES_ROOT\Drive\shell\cmd] @="@shell32.dll,-8506" "Extended"="" "NoWorkingDirectory"="" [HKEY_CLASSES_ROOT\Drive\shell\cmd\command] @="cmd.exe /s /k pushd \"%V\""
Pingback: Tweets that mention Command Prompt and PowerShell Here with Console.exe « Thoughtful Code -- Topsy.com
Okay I give up. What tool is used to make the registry entries. If it is simply a registry setting, perhaps a quick little powershell script can make easy work of it.
Save as text files with a .reg extension. Then, import the setting with regedit.exe.
Thanks for the registry entries to create the PowerShell menu. I used your code as a template to create something similar for the Visual Studio 2010 Command Prompt:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\vs2010prompt]
@="Open VS2010 Command Prompt here"
"Extended"=""
[HKEY_CLASSES_ROOT\Directory\shell\vs2010prompt\command]
@="C:\\Windows\\system32\\cmd.exe /k \"cd /D \"%V\" && \"c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat\"\" x86"
[HKEY_CLASSES_ROOT\Directory\Background\shell\vs2010prompt]
@="Open VS2010 Command Prompt here"
"Extended"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\vs2010prompt\command]
@="C:\\Windows\\system32\\cmd.exe /k \"cd /D \"%V\" && \"c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat\"\" x86"
[HKEY_CLASSES_ROOT\Drive\shell\vs2010prompt]
@="Open VS2010 Command Prompt here"
"Extended"=""
[HKEY_CLASSES_ROOT\Drive\shell\vs2010prompt\command]
@="C:\\Windows\\system32\\cmd.exe /k \"cd /D \"%V\" && \"c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat\"\" x86"