Make sure the command's type is set to MS-DOS Batch Function and add a pause command to the last line. That way you can see what the output was without the window closing immediately.
If you want to see what command-line is being generated, stick an echo at the start of it to print the line instead of executing it. There's also the DopTest tool by Tanis which works better than echo for some things, like checking for quotes, and I think also means you don't need the pause command.