C#关闭计算机

C#写的关机程序,代码简单主要是用Process类来操作,当然也可以调用

                                系统API来执行操作。                                       

                                主要代码为:

                                关机

                                Process.Start("shutdown", "-s -t 0");

                                注销

                                Process.Start("shutdown", "-l ");

                                重启

                                Process.Start("shutdown", "-r -t 0");

                                更多的关于Process类的操作,可以了解

                     http://msdn.microsoft.com/zh-cn/library/system.diagnostics.process_members(VS.80).aspx

posted @ 2009-12-18 23:29  Xingsoft  阅读(4535)  评论(2编辑  收藏  举报