码迷,mamicode.com
首页 > 其他好文 > 详细

鼠标右键打开命令行cmd(管理员身份)

时间:2018-11-20 15:17:24      阅读:535      评论:0      收藏:0      [点我收藏+]

标签:文件   dir   you   uac   key   popd   res   .exe   admin   

参考: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(管理员身份)

标签:文件   dir   you   uac   key   popd   res   .exe   admin   

原文地址:https://www.cnblogs.com/pu369/p/9988327.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!