Shutdown command (via Rob McLaws)

This morning, on the drive to work I was thinking about some code I had to write today that had to shut down the PC after it had finished.  Aware that I could use ExitWindowsEx to the job, I wasn't relishing - as I never do - declaring said method so that I could call it from managed code.

What do I discover when I refresh SharpReader this morning?  Rob McLaws points me in the direction of a Windows command line command that can restart, shutdown and otherwise screw with any computer on the network.  So, now I have an option - either call ExitWindowsEx, or give Process.Start an instruction to run “shutdown”.

What's amazing to me about this is it brings home just how damn useful blogs actually are as a learning experience, and how timely information that comes over this media can be.  I was thinking about a problem, and lo and behold there I am instantly in touch with someone who's thinking about a solution to my problem from an entirely different perspective. 

Updated: As far as I can tell, not supported on anything other than XP and Win2K3.

2 Comments

Comments have been disabled for this content.