如何将参数传递给以管理员身份自动运行的脚本?
If WScript.Arguments.Count >= 1 Then
Command1 = WScript.Arguments.Item(0)
End If
If WScript.Arguments.Named.Exists("elevated") = False Then
CreateObject("Shell.Application").ShellExecute "wscript.exe", """" & _
WScript.ScriptFullName & """ /elevated", "", "runas", 1
WScript.Quit
End If
WScript.Echo Command1
答案 0 :(得分:1)
将参数添加到您已有的参数列表(users
):
/elevated