Forum Discussion

roryLIT's avatar
roryLIT
Contributor
12 years ago

Running command line from GroovyScript

Hi,

I'm trying to run commands through the command prompt from groovy. In the Task Manager it shows the cmd prompt opening but nothing is happening. Yet when I run the exact same command manually in the cmd prompt it works fine. Any ideas anyone?

def processBuilder=new ProcessBuilder("cmd.exe", "cd C:/Backup Exclusions/SoapUI-Pro-4.6.1/bin && testrunner.bat -sALMReporting -cTest1 -r -a -flocation -Rreport -FTXT -EDefault C:/Users/N21d7027/Documents/SoapUI/Projects/ParallelTests-soapui-project.xml && EXIT")
processBuilder.redirectErrorStream(true)
processBuilder.directory(new File("C:/Backup Exclusions/SoapUI-Pro-4.6.1/bin"))
def process = processBuilder.start()
  • PaulDonny's avatar
    PaulDonny
    Regular Contributor
    I had a similar issue in Java. I started to put my arguments into arrays and it fixed it.