why don't you package the command as a batch file and run the batch file instead?
@ OFF
command here
exist status code here
in php script
exec("somebatch.bat");
you may want to dust off some old DOS books for the syntax but in theory this should work.