右鍵加入管理員cmd,PowerShell
阿新 • • 發佈:2020-12-20
技術標籤:cmdpowershell
前言
方便大家在任意位置以管理員身份執行cmd PowerShell,只用建立reg檔案並編輯以下程式碼再雙擊匯入即可,效果如圖↓
一、使用步驟
1.cmd新增程式碼
程式碼如下:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\background\shell\OpenCmdHereAsAdmin] @="Open cmd here as Admin" "Icon"="imageres.dll,-5324" [HKEY_CLASSES_ROOT\Directory\background\shell\OpenCmdHereAsAdmin\command] @="PowerShell -windowstyle hidden -Command \"Start-Process cmd -ArgumentList '/s,/k,pushd,%V' -Verb RunAs\""
2.powershell新增程式碼
程式碼如下:
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\background\shell\PowerShellAsAdmin] @="Open PowerShell here as admin" "HasLUAShield"="" "Icon"="powershell.exe" [HKEY_CLASSES_ROOT\Directory\background\shell\PowerShellAsAdmin\command] @="PowerShell -windowstyle hidden -Command \"Start-Process cmd -ArgumentList '/s,/k,pushd,%V && start PowerShell && exit' -Verb RunAs\""
總結
以後可以儲存reg檔案再次匯入,這樣很方便呼叫cmd與powershell了