dy211
asked on
After running a program using .run in VBS, how do I store the outputs?
Below is the code I have so far to run jsonchk.exe, however jsonchk executes in a cmd window and disappears almost instantly before I can see any output.
jsonchk.exe is ran by jsonchk < param, so strLine is provided.
So my question is, how can I store the output produced by jsonchk.exe into a .txt file and for each function call in the for loop, APPEND the new output to that .txt file?
Thanks!
jsonchk.exe is ran by jsonchk < param, so strLine is provided.
So my question is, how can I store the output produced by jsonchk.exe into a .txt file and for each function call in the for loop, APPEND the new output to that .txt file?
Thanks!
for each strIn in arrFileLines
processLine(strIn)
next
function processLine(strLine)
dim objShell
set objShell = wscript.CreateObject("WScript.Shell")
objShell.Run "./jsonchecker/bin/Release/jsonchk.exe < "&strLine, 4, True
set objShell = Nothing
end function
ASKER
sirbounty, thanks for the quick response. Exec definitely seems to be the better option. However, in order to run jsonchk, it must be jsonchk.exe < something or jsonchk < something
so when I set strCmd to strCmd = ".\jsonchecker\bin\Release \jsonchk < "&strLine
and when I .Exec(strCmd) I get the error from StdErr.ReadAll: "Illegal characters in path"
however, just typing .\jsonchecker\bin\Release\ jsonchk < something.json in cmd.exe works.
anyone know how to fix this problem??
so when I set strCmd to strCmd = ".\jsonchecker\bin\Release
and when I .Exec(strCmd) I get the error from StdErr.ReadAll: "Illegal characters in path"
however, just typing .\jsonchecker\bin\Release\
anyone know how to fix this problem??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hmm - try removing the ,4, True as well - I'm not certain those are valid for Exec...
ASKER
TY sirbounty,
strCmd = "cmd /c C:\""Documents and Settings""\person1\Desktop \scripts\j sonchecker \bin\Relea se\jsonchk .exe < "&strLine
worked.
strCmd = "cmd /c C:\""Documents and Settings""\person1\Desktop
worked.
Glad I could help - thanx for the grade! :^)
Example (may require some manipulating based on what you're looking to achieve):
Open in new window