I've just started using VBScript, could anyone assist with an issue I have?
I have mutiple batch files that I would like to open at the same time. Once all the batch files complete, I want to open an excel document.
I have a script that will open a single batch file, wait for completion and open excel. I need to modify this to open mutiple batch files at the same time though.
I will need to open upto five batch files for this script; they will all be in the same directory. This directory will contain other files as well as other batch files that are not needed for this script so I would like to specifically name the batch files I want to open.
sBatFile = "o:\Automation\test.bat"
Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
If Not oFSO.FileExists(sBatFile) Then
MsgBox "Could not find batch file, quitting!", _
vbCritical + vbSystemModal, "Text search"
' just in case there is spaces in the path
sBatFileShort = oFSO.GetFile(sBatFile).ShortPath
' Run the batch file, and let the VBScript wait for
' the batch file to finish
oShell.Run sBatFileShort, 1, True
Set Ex = CreateObject("Excel.Application")
.Visible = True
.Workbooks.Open "O:\Automation\Daily Template.xlsm", , , , ,"pw"