Set*_*eth 2 windows vbscript administrator
是否可以使用shell.run命令以管理员身份运行指定程序?
例如:
shell.run(cmd.exe) <---Run this as admin
shell.run(Notepad) <---Run this as normal
Run Code Online (Sandbox Code Playgroud)
我知道我可以执行脚本以管理员身份运行,但这意味着该脚本中的所有内容都以管理员身份执行。
我的另一个选择是分离脚本并以管理员身份运行一个脚本,并在该脚本中包含需要以管理员身份运行的内容,然后调用另一个脚本来正常运行并运行该脚本。
Set oShell = CreateObject("Shell.Application")
oShell.ShellExecute "cmd.exe", , , "runas", 1
oShell.Run "nodepad.exe"
Run Code Online (Sandbox Code Playgroud)
(来源:http : //social.technet.microsoft.com/Forums/eu/ITCG/thread/310e57f9-2367-4293-9f97-53d0e077aacc)
(更多信息:http : //ss64.com/vb/shellexecute.html)
| 归档时间: |
|
| 查看次数: |
38490 次 |
| 最近记录: |