1. 程式人生 > >滑鼠右鍵開啟命令列cmd(管理員身份)

滑鼠右鍵開啟命令列cmd(管理員身份)

參考:https://blog.csdn.net/bdss58/article/details/54745380

新增到登錄檔

將下面命令儲存為reg檔案:

Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\Directory\shell\runas]

[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Open command window here as Administrator"
"HasLUAShield"=""

[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@
="cmd.exe /s /k pushd \"%V\"" [-HKEY_CLASSES_ROOT\Directory\Background\shell\runas] [HKEY_CLASSES_ROOT\Directory\Background\shell\runas] @="Open command window here as Administrator" "HasLUAShield"="" [HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command] @="cmd.exe /s /k pushd \"%V\"" [-HKEY_CLASSES_ROOT\Drive\shell\runas] [HKEY_CLASSES_ROOT\Drive\shell\runas] @
="Open command window here as Administrator" "HasLUAShield"="" [HKEY_CLASSES_ROOT\Drive\shell\runas\command] @="cmd.exe /s /k pushd \"%V\"" [-HKEY_CLASSES_ROOT\LibraryFolder\background\shell\runas] [HKEY_CLASSES_ROOT\LibraryFolder\background\shell\runas] "HasLUAShield"="" @="Open command window here as Administrator
" [HKEY_CLASSES_ROOT\LibraryFolder\background\shell\runas\command]

儲存 檔名為 Add_Open_Command_Window_Here_as_Administrator.reg 
然後雙擊執行就可以了。

解除安裝

類似上面的,執行下面登錄檔命令就可以了:

Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\Directory\shell\runas]

[-HKEY_CLASSES_ROOT\Directory\Background\shell\runas]

[-HKEY_CLASSES_ROOT\Drive\shell\runas]

[-HKEY_CLASSES_ROOT\LibraryFolder\background\shell\runas]
~ 

 

補充:

1、HasLUAShield   By creating a registry value named HasLUAShield (REG_SZ) on the static verb, you can add the UAC shield icon to the corresponding item in the right-click menu. 參考:https://www.winhelponline.com/blog/add-uac-shield-icon-right-click-context-menu-windows-7/

2、pushd   The Pushd command stores the current directory for use by the popd command, and then changes to the specified directory.  參考:http://www.windowscommandline.com/pushd/