1. 程式人生 > >鼠標右鍵打開命令行cmd(管理員身份)

鼠標右鍵打開命令行cmd(管理員身份)

lib ext ack help tail 註冊 right scom try

參考: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/

鼠標右鍵打開命令行cmd(管理員身份)