Monday, January 7, 2013

Run OS command

//windows
String cmd = "ping google.com"

String[] command = ["CMD", "/C", cmd] as String[]
ProcessBuilder builder = new ProcessBuilder(command)
Process process = builder.start()

println process.text

println "*"*5+"DONE"+"*"*5

No comments:

Post a Comment