系統知識網 系統知識 Win10系統右鍵添加Powershell和命令提示符方法

Win10系統右鍵添加Powershell和命令提示符方法

Win10系統可以通過SHIFT+右鍵的方式呼出右鍵菜單中的Powershell控制臺選項,但是對於經常需要操作的用戶來說不免有些麻煩,下面小編分享的方法是不需要按Shift右鍵就可以的,下面一起來看看。; 若原先有,先刪除原來的[-HK。

Win10系統可以通過SHIFT+右鍵的方式呼出右鍵菜單中的Powershell控制臺選項,但是對於經常需要操作的用戶來說不免有些麻煩,下面小編分享的方法是不需要按Shift右鍵就可以的,下面一起來看看。

; 若原先有,先刪除原來的
[-HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin]
 
;1.右鍵:命令行
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere]
@="在此處打開命令行窗口"
 
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere\command]
@="cmd.exe -noexit -command Set-Location -literalPath \"%V\"" 
 
;2.右鍵:命令行(管理員)
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@="在此處打開命令行窗口(管理員)"
"ShowBasedOnVelocityId"=dword:00639bc8
 
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""
 
;3.shift+右鍵:Powershell(管理員)
[HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin]
@="在此處打開 Powershell 窗口(管理員)"
"Extended"=""
 
[HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin\command]
@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
 



;4.設置右鍵 管理員打開cmd的另一種方法(可用來替換上面的2)
 通過Powershell調起,會閃過一次Powershell的窗口,去掉下面幾行的[; ]可以取消註釋
[-HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHereAdmin]

[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHereAdmin]
 @="在此處打開命令行窗口(管理員)"

[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHereAdmin\command]
@="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k, pushd,%V' -Verb RunAs\""
返回顶部