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?
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
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.