It's really a matter of personal style.

Some young guys who still have good vision (only been staring at a monitor for 4-5 years, not 34 like me!) don't use spaces between the operators. For me, it helps keep the lines from running together. Also, the breaks allow me to double-click select a specific word and not a whole block.

I prefer the $Cmd = 'command string' for two reasons. For complex commands, I can "build" the string in small chunks, making it less error prone (especially when there's lots of quotes or parens). It also - as you saw - lets me display the command before it runs so I can make sure it's correct. I often comment-out the display of the $Cmd once I have it running properly.
 Code:
$Cmd='%COMSPEC% /c'
$Cmd = $Cmd + ' command'
$Cmd = $Cmd + ' arg "arg 2"'
for example.


Please test the TimeToDie logic thoroughly.. I threw that together without any testing based on something I use, but don't have access to right now.

The $SO and $RC in your original code serve the same purpose, so no need to define/use 2 different vars.. just a "sanity" thing. I'm also big on comments. A typical larger project has nearly a 1:1 ratio between comments and code.

Lastly, it won't make a huge difference, but I'd set the $TimeToDie value just before you begin the loop waiting for the command to launch, not before you launch the command. Otherwise you shortchange yourself a few milliseconds. ;\)

Glenn
_________________________
Actually I am a Rocket Scientist! \:D