cokyn
13 years agoContributor
CHDIR and run *.bat file from the current dir
I would like to run bat file from script but when I tried to do that I encoutered error. That was because the bat file needs to be started from certain location (there are defined relative paths inside).
In my case, the location is "c:\Program Files (x86)\SmartAIM\ESI_Client\run.bat" If I run bat from the location (c:\Program Files (x86)\SmartAIM\ESI_Client) everythig is working well, but so far I was not able to change dir and run the bat file from script. I tried something like this:
var WScriptObj = Sys.OleObject("WScript.Shell");
ESI_run_bat_location="\"c:\\Program Files (x86)\\SmartAIM\\ESI_Client\"";
Log.Message(ESI_run_bat_location);
WScriptObj.Exec("chdir "+ESI_run_bat_location);
WScriptObj.Exec(run.bat);
Any ideas please?
In my case, the location is "c:\Program Files (x86)\SmartAIM\ESI_Client\run.bat" If I run bat from the location (c:\Program Files (x86)\SmartAIM\ESI_Client) everythig is working well, but so far I was not able to change dir and run the bat file from script. I tried something like this:
var WScriptObj = Sys.OleObject("WScript.Shell");
ESI_run_bat_location="\"c:\\Program Files (x86)\\SmartAIM\\ESI_Client\"";
Log.Message(ESI_run_bat_location);
WScriptObj.Exec("chdir "+ESI_run_bat_location);
WScriptObj.Exec(run.bat);
Any ideas please?