how to set PowerShell as default instead of cmd.exe
I'm trying to get PS to open up instead of cmd.exe when I do a Shift+left-click
and select open command window here
I changed the %ComSpec% system variable and even added on in my user variable pointing to the PS path, but no result, cmd.exe is still opening up.
I must be doing something wrong, could someone help me please ?
Solution 1:
Inside the registry you can redirect cmd.exe to Powershell.
Start regedit.exe
, go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
and create a key cmd.exe
. Now create a string (REG_SZ) with the name Debugger
and enter the full path to the Powershell.exe
When you now try run cmd.exe, Powershell is started instead.
Solution 2:
Changing the following 3 values did it for me in in Win7 at least. Can't confirm for Win8 right now, but registry locations should be the same (obviously change the path to PowerShell.exe if it's different on your system).
1.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Drive\shell\cmd\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\PowerShell.exe -NoExit -Command \"cd '%v'\""
2.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\cmd\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\PowerShell.exe -NoExit -Command \"cd '%v'\""
3.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\cmd\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\PowerShell.exe -NoExit -Command \"cd '%v'\""
Note 1: You can use %SystemRoot%
instead of C:\\Windows
if you change the data type of cmd\command\(Default)
from the default REG_SZ to REG_EXPAND_SZ.
Note 2: The cd command fails if the current working directory's name contains a single quote. I have asked about this here: Opening PowerShell at the current working directory from the registry.
Another option would be to add a new Open PowerShell Here command to the context menu instead of replacing cmd.
Also, in Win8 you should be able to quickly open PowerShell with Alt+F, R: