Vbscript subprocesses

From wikinotes
Revision as of 15:40, 29 January 2020 by Will (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Shell Arguments

Set args = Wscript.Arguments
For Each arg In args
    Wscript.Echo arg
Next

' Access Args by Num
WScript.Arguments.Item(0)
WScript.Arguments.Item(1)

Running Shell Commands

Set oShell = WScript.CreateObject("WSCript.shell")
oShell.run "My_Function.exe -param blah"           ' Run command
oShell.run "My_Function.exe -param blah", 1, TRUE  ' Run command and wait (show console window)
oShell.run "My_Function.exe -param blah", 0, TRUE  ' Run command and wait (hide console window)