Psexec is a Microsoft add-on utility that can copy an exeutible file to a remote machine and run it there.
Not sure what you mean by DOS envoronment but when I run this from the Windows Start command or from a CMD window (using the -d option) it exits normally.
What I ended up doing is adding lines to the remotely executed batch file that capture standard out and standard error and save to a file on the network. Then I can read that and search for "task complete" strings and/or errors.
Reseaching Psexec, I find that it outputs std error and std out in a strange way that causes similar issues when called from other languages.
There are alternative programs out there that do not have these limitations. (PowerShell, RemoteExec, and BeyondExec for example)