Question: I am trying to start an external executable file via Groovy but got some problems with it! I just want to start the `rs.exe` with several parameters to create a PDF-file using the SSRS. 

But as soon as I try to get the return value/exit-code it doesn't work anymore! But I want to grab the generated file and add it to a database, so I need a return value to know when its generated. This works totally fine for generating:

```
def id = 1  
def cmd = """ C://Program Files (x86)//...//rs.exe 
    -i C:\\export.rss 
    -s http://localhost/ReportServer_SQLEXPRESS 
    -v ID=${id}
    -e Exec2005 """
def proc = cmd.execute()

```

But I don't get any return value/exit-code. I already tried different way, e.g. 

```
proc.waitFor()

```

but I or 

```
cmd.execute().value

```

but nothing worked. When I start the `rs.exe` with all my provided data in Windows I get the return "Process succesfully ended". Any Groovy-specialists here that can help me out?

Answer: 
Try executing command when it's defined in the following way:

```
def cmd = ['cmd', '/c', 'C://Program Files (x86)//...//rs.exe', '-i', 'C:\\export.rss', '-s', 'http://localhost/ReportServer_SQLEXPRESS', '-v', "ID=${id}", '-e', 'Exec2005']
def proc = cmd.execute()

```
I was able to run it now and get the exit-code. But without those escape forward-slashes I wasn't able to let it run. To get the exit-codes I just used "proc.text" and it works perfectly now.

It was working before but I didn't know how to get the exit-codes, ".text" solved it completely. Thanks for your help!