Reputation: 11
command = ["C:/Users/Desktop/try.bat"]
def command1=command
def cmd = command1.execute()
cmd.waitFor()
This is my code. But I need to pass 4 arguments to try.bat
. Out of these one argument is optional. How to handle it?
Upvotes: 0
Views: 2705
Reputation: 1349
Maybe you should try
def command = """C:/Users/Desktop/try.bat arg1 arg2 arg3 arg4"""
as the official docs provided suggest http://groovy.codehaus.org/Executing+External+Processes+From+Groovy
Upvotes: 0
Reputation: 37008
add more items in the array
["command", "param1", "param2"].execute()
as stated in the official docs http://groovy.codehaus.org/Executing+External+Processes+From+Groovy
Upvotes: 1