0
votes

Am using a vbscript program in which i do the following process,

i call a bat file and based on it's out put i need to call another bat file.

for e.g one.bat and two.bat are the batch files..

one.bat file will print message "Success" or "fail" in command window. i have to read the string through vbscript and if success have to call two.bat

i have tried using exec but its opening a command window, i don't want any command windows to be opened in GUI while executing the VBS.

Am new to this please explain with example.

1
You can use .Exec() method, without console window flash, temp files and unexpected WScript.Echo output muting, check this answer. - omegastripes

1 Answers

0
votes

As you can't avoid a console when you call .Exec from a GUI (.HTA?), you must use .Run. This answer shows how to capture the the output via files.

But: As you just need to know whether one.bat succeeded or failed, you could use .Run's return value (ERRORLEVEL/Exit code of one.bat) and avoid the problem of reading its output.