In VBScript, the built-in Shell.Run
method does not provide for output redirection, so the following workaround must be used:
Running command line silently with VbScript and getting output?
Dim retVal
retVal = WshShell.Run( "cmd /c ""commandGoesHere"" > c:\temp\output.txt", 0, True )
However returnValue
will have the return value of cmd
, not of commandGoesHere
.
I thought I could check shell.Environment("ERRORLEVEL")
but presumably this would also be cmd
's return value, and not commandGoesHere
.
...so how can I get commandGoesHere
's return value and simultaneously redirect its output to another file?