Forum Discussion
Hi,
This code snippet should help:
' Run the command and wait for completion
CreateObject("WScript.Shell").Run AFileName, 1, True
More info about used functions is available in MSDN.
Thanks Alex!
That code works to get my batch file started and waits for its completion before starting other tests.
But when it starts, I need to enter something like the version number of the install files I am looking for. I would like to be able to pass that as a parameter as well, so that the batch file will use that and start it's execution without waiting for user to enter the version info.
Wondering if there is a way to incorporate both passing a parameter to the called batch file as well as waiting for it to complete in the same line of code?
- joseph_michaud10 years agoModerator
In a Keyword test? Just put it all together. Something like this...
Set Variable Value Variables.Project.Var1 "versionInput=Build_Version"
Run Code Snippet Sys.OleObject("WScript.Shell").Run("C:\Folder1\Folder2\App_Name.bat " + Project.Variables.Var1, 1, true)
- DeepaJ10 years agoContributor
Thanks, however still having issues.
I have a keyword test that calls this script and passes it the Build_Version variable.
Running this code, will just bring up the command window for a split second and won't continue executing:
Sub Run_Build (Build_Version)
Sys.OleObject("WScript.Shell").Run "C:\FolderA\FolderB\App_Name.bat + Build_Version", 1, True
End Sub
However this bit of code works correctly:
Sub Run_Build (Build_Version)
CreateObject("WScript.Shell").Run "C:\FolderA\FolderB\App_Name.bat18.00.02", 1, True
End Sub
But, here I want to replace 18.00.02 with the variable. So when I do this, it does not work !
Sub Run_Build (Build_Version)
CreateObject("WScript.Shell").Run "C:\FolderA\FolderB\App_Name.bat Build_Version", 1, True
End Sub
If I have it as + Build_Version, it will say path not found.
- DeepaJ10 years agoContributor
This works! It takes a parameter and test run resumes only after the batch file has completed it's execution.
Sub Run_Build (Build_Version)
dim shell, x, y, z
x="C:\FolderA\FolderB\"
y=x & "App_Name.bat "
z=Project.Variables.Build_Version
set shell=CreateObject("WScript.Shell")
shell.run y + z, 1, true
End sub
Related Content
- 5 months ago
- 3 years ago
- 4 years ago
Recent Discussions
- 21 hours ago
- 21 hours ago