Forum Discussion
Try the below code, do not use pause statement in BAT file.
def cmd = "sample.bat"
def process = "$cmd".execute();
process.waitFor();
- Sunny28 years agoNew Contributor
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
- prashobkt8 years agoContributor
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==================================