I think the information here: http://malektips.com/xp_dos_0002.html will explain this better than me.
However, there is still an error handling problem (what if the remote machine is not working?). cmd.exe is completely useless for any remote actions for the most part, using powershell would allow much more.
EDIT ::
In fact, you can execute a program stored locally with psexec (it is copied and executed locally on the server side) - would this be a more viable alternative?
Not knowing which commands you intend to use to do this much further.
EDIT (2) ::
If this is only one command that you run, just save it in a separate file, for example "remote_dir_listing.cmd", and then use psexec with
psexec \\server -u <user> -p <pass> -c -f remote_dir_listing.cmd
This will copy the local file to the remote side each time it is executed (if you want to expand it). Thus, you will get around the need for a pause altogether - only when psexec opens the pipes does it start, and as soon as it finishes, it quietly closes.
source share