How to run a bat file which is present in some other location on the Computer
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to run a bat file which is present in some other location on the Computer
Hi
I have a set of test cases that I need to run for every execution. To receive valid responses, I need to tunnel to the ports using a bat file which I need to open manually each and every time
Is there any way I can open the bat file using Groovy Script before I start the execution in SOAP UI?
Thanks
Sunny
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try the below code, do not use pause statement in BAT file.
def cmd = "sample.bat"
def process = "$cmd".execute();
process.waitFor();
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks @prashobkt
I tried to execute the code
As my file is in an external folder which is something like "C:/XXX/XXXX/file.bat", I included the same in the script as follows
def cmd = "C:/XXX/XXXX/file.bat"
def process = "$cmd".execute();
process.waitFor();
When this script is run, I got a dialog box something like Script-result:1 (screenshot attached) . However I couldn't see that file is opened.
Can you please help me if you have any idea on this?
Thanks
Sunny
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As per my knowledge
Script-Result-1 is failure and 0 is success.
If you are providing any file as input in .batfile , please use absolute path. The .bat files are command line tools and are processed in Background so you cannot see any window.
Below is the batfile I used to test.
=============my.bat================
@echo off
echo This is a test
Mkdir d:\rt
==================================
