如何将参数传递给以管理员身份自动 运行 的脚本?
How to pass arguments to a script that auto run as administrator?
如何将参数传递给自动 运行 作为管理员的脚本?
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
将参数添加到您已有的参数列表中 (/elevated
):
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 & <b>""" " & Command1 &</b> " /elevated", "", "runas", 1
WScript.Quit
End If
WScript.Echo Command1
如何将参数传递给自动 运行 作为管理员的脚本?
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
将参数添加到您已有的参数列表中 (/elevated
):
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 & <b>""" " & Command1 &</b> " /elevated", "", "runas", 1
WScript.Quit
End If
WScript.Echo Command1