I've created a single file.bat that execute correctly two different vbs files:
cscript "\\server_1\dir\file_M_1.vbs" "\\server_1\dir\muc1.xlsm"
cscript "\\server_2\dir\file_H_2.vbs" "\\server_2\dir\muc2.xlsm"
the code of the two files.vbs is the same, because it was created to do the same thing in two different servers.
This is the contents of file_M_1.vbs, that simply runs the macro called "copy_M":
Dim args, objExcel
Set args = WScript.Arguments
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Open args(0)
objExcel.Visible = False
objExcel.Run "copy_M"
objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close(0)
objExcel.Quit
Instead this is the code of file_H_2.vbs, that runs macro called "copy_H":
Dim args, objExcel
Set args = WScript.Arguments
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Open args(0)
objExcel.Visible = False
objExcel.Run "copy_H"
objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close(0)
objExcel.Quit
I' d like to know if there' s the possibility to collect all three pieces of code in only one file.bat or file.exe (to be even scheduled to run in a specific time with the task scheduler of windows7.)