方法は色々とありますが(Win32APIのExitWindowsExをコールするとか)
ここでは手っ取り早い方法だけ挙げます。
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(); psi.FileName = "shutdown.exe"; // コマンドラインパラメータ -s:シャットダウン -f:強制的に psi.Arguments = "-s -f"; // ウィンドウ非表示に(効果なし?) psi.CreateNoWindow = true; // シャットダウン System.Diagnostics.Process p = System.Diagnostics.Process.Start(psi);
コメントを残す