Home > OS >  How to get .vbs output in the same window of a .bat file
How to get .vbs output in the same window of a .bat file

Time:05-13

I have a batch file that does a lot of different things and within that batch file, at some step, I'm running a VBS script. The problem is, the execution/output of this script will always open a new window, runs the script there and then it closes leaving me with no output. I want to keep the output of that file in the same window as my batch file. I also want to wait until that VBS script is finished before it continues with the rest of the commands in my batch file.

This is how I'm running the VBS script in my batch file:

start cscript "C:\install.vbs"

Note that I cannot modify the .vbs script.

CodePudding user response:

Don't use the start command. Type start /?.

C:\WINDOWS\system32>start /?
Starts a separate window to run a specified program or command. 

Start is used to start programs in unusual ways. Normal ways you just type the inbuilt command or full path to the program.

cscript "C:\install.vbs"

Because cscript is in system32 it will always be found. If it was elsewhere specify the fully qualified filename.

  • Related