I've been working to make manual processes more of a one-click process and I've run into an issue with these msgbox popups from a VBScript script.
Essentially, I am using PowerShell and doing something like:
foreach ($loc in $locs):
& cscript $loc
Where the $loc in $locs is a variable holding the path of a .vbs file that needs to be run.
The issue is that one of our developers included two msgbox statements in each of the .vbs files and those pop up and require you to click OK. It would be trivial to edit the VBScript scripts and remove these, but I do not want to change our developers' scripts - so the question is: is it possible to make PowerShell react to the msgbox(s) that are generated from the cscript line?
I'm not sure how I would bring the box into context or react to it via PowerShell.
Run the scripts in batch mode. This will prevent any prompt from stalling execution:
foreach ($loc in $locs){
& cscript //B $loc
}
From the cscript /?
usage message:
Usage: CScript scriptname.extension [option...] [arguments...]
Options:
//B Batch mode: Suppresses script errors and prompts from displaying
//D Enable Active Debugging
//E:engine Use engine for executing script
//H:CScript Changes the default script host to CScript.exe
//H:WScript Changes the default script host to WScript.exe (default)
//I Interactive mode (default, opposite of //B)
...