Forum Discussion
nastester
Regular Contributor
I use this:
function runBatchFile(batchFilePath) {
try {
var process = Sys.OleObject("WScript.Shell");
process.Run('cmd.exe /C "' + batchFilePath + '"', 1, true);
while (process.Status == 0) {
Delay(100);
}
}
catch (e) {
Log.Error("An error occurred while running the batch file: " + e.message);
}
Log.Message("Batch file executed")
}
var batchFilePath = Project.ConfigPath + "SmokeTestCleanup.bat";
torus
7 months agoContributor
Thanks for the tip nastester. That worked great. I tried to get the cmd.exe /C <batchFile> to work for a while but was unsuccessful (I might not have been putting in the double back slashes and might have messed up where I placed the quotes). Your example works perfectly plus has error catching. Thanks for the tip!
Related Content
- 8 years ago
- 8 years ago
Recent Discussions
- 2 days ago
- 7 days ago
- 11 days ago