如何将参数传递给以管理员身份自动运行的脚本?

时间:2015-11-01 20:29:31

标签: vbscript elevated-privileges

如何将参数传递给以管理员身份自动运行的脚本?

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

1 个答案:

答案 0 :(得分:1)

将参数添加到您已有的参数列表(users):

/elevated