Windows右键菜单添加从当前目录以管理员权限启动CMD
参考:https://blog.csdn.net/ujsDui/article/details/79191921
在当前文件夹中以管理员权限启动 CMD 并没有特别方便的方法。通常只能先以管理员身份运行 CMD,然后再使用 cd 命令切换目录,或者通过命令行方式进行提权,操作都比较繁琐。
参考上述博客,对右键菜单进行了优化,增加“在当前目录以管理员权限打开 CMD”的功能。
添加 Windows 右键菜单:在当前目录以管理员权限启动 CMD
将以下内容保存为 .reg 文件后导入注册表:
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\shell\runas]
[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Open CMD as Administrator here"
"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 CMD as Administrator here"
"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 CMD as Administrator here"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Drive\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""
删除 Windows 右键菜单:在当前目录以管理员权限启动 CMD
将以下内容保存为 .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]

浙公网安备 33010602011771号