Forum Discussion
nastester
6 months agoRegular 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";
- torus6 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
- 7 years ago
- 3 years ago
Recent Discussions
- 15 hours ago