Forum Discussion
Not only do I need to wait for the batch file execution to complete, I also need to pass a variable to the bacth file from my calling keyword test.
I've tried the following but none of these are working:
Sys.OleObject("WScript.Shell").Exec("cmd /c """"C:\Folder1\Folder2\App_Name.bat"" versionInput=Build_Version""")
Call Sys.OleObject("WScript.Shell").Run("""C:\Folder1\Folder2\App_Name.bat"", 1, true")
Call Sys.OleObject("WScript.Shell").Run("""C:\Folder1\Folder2\App_Name.bat"" versionInput=Build_Version")
Appreciate if someone can help.
- Colin_McCrae10 years agoCommunity Hero
Is your batch file set up to parse input parameters correctly? No use passing them in if it's not set up to use them!
http://stackoverflow.com/questions/26551/how-to-pass-command-line-parameters-to-a-batch-file
And telling if it's complete? Depends what it does. If there is something on-screen you can watch for, use that. If you want to look into using exit codes (either reading them or using them within the batch script to trigger some sort of on-screen indicator), start reading here:
http://steve-jansen.github.io/guides/windows-batch-scripting/part-3-return-codes.html
- DeepaJ10 years agoContributor
Yes, the batch file reads my input correct and uses it to get the install files that I am looking for. I used ''TestedApps.AppName.Run' command and passed the parameter. This works correctly, but the problem is that while the batch file is still getting all the files, my test suite contines with the rest of the tests.
I only want the rest of the tests to start, once the batch file execution is done. The amount of time required for this varies from 5 minutes to maybe 10 or more minutes. That is the reason I need a way to delay the rest of the tests from executing until this is finished first.
The batch file also has a return code of 0 if it found all the install files correctly.
- AlexKaras10 years agoChampion Level 3
Hi,
This code snippet should help:
' Run the command and wait for completion
CreateObject("WScript.Shell").Run AFileName, 1, TrueMore info about used functions is available in MSDN.
Related Content
- 3 months ago
- 3 years ago
- 4 years ago
Recent Discussions
- 10 hours ago