I want to perform two tasks in batch file. First, I create a file using a small application in c# and this application returns some value if file creation done successfully. Then on the basis of output from task, I want perform robocopy operation. I need some help related to keep the output of first operation and later on use it in comparison to perform second operation.

```
xyz.exe
if outputofxyz=="OK" Robocopy "\\Directory1" "Directory2" 

```

I want to know that can I save output of xyz.exe in some variable? or should I use below syntax:

```
if xyz.exe=="OK" Robocopy "\\Directory1" "Directory2" 

```