是否可以使用shell.run命令以管理员身份运行指定程序?
例如:
shell.run(cmd.exe) <---Run this as admin
shell.run(Notepad) <---Run this as normal
我知道我可以执行脚本以管理员身份运行,但这意味着该脚本中的所有内容都以管理员身份执行。
我的另一个选择是分离脚本并以管理员身份运行一个脚本,并在该脚本中包含需要以管理员身份运行的内容,然后调用另一个脚本运行并正常运行该脚本。
最佳答案
Set oShell = CreateObject("Shell.Application")
oShell.ShellExecute "cmd.exe", , , "runas", 1
oShell.Run "nodepad.exe"
(来源:http://social.technet.microsoft.com/Forums/eu/ITCG/thread/310e57f9-2367-4293-9f97-53d0e077aacc)
关于windows - VBScript- 作为管理员的单行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13060215/