新建一个文本文档,复制下面的代码,选择另存为,文件类型选择为所有文件,编码选择ANSI,文件名为PowershellAdmin.reg(文件名可以随便起,但是后缀名需要是.reg,表明它的文件类型是注册表项),然后双击PowershellAdmin.reg合并注册表,提示如下内容
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin]
"Extended"=""
"NoWorkingDirectory"=""
"ShowBasedOnVelocityId"=dword:00639bc8
@=""
"MUIVerb"="在此处打开管理员 Powershell 窗口(A)"
[HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin\command]
@="powershell.exe -command Start-Process powershell -ArgumentList \\\"-noexit\\\",\\\"Set-Location -literalPath '%V'\\\" -Verb runAs"