Right now I'm restarting my app with the following code
private static void Restart()
{
ProcessStartInfo proc = new ProcessStartInfo();
proc.WindowStyle = ProcessWindowStyle.Hidden;
proc.FileName = "cmd";
proc.Arguments = "/C shutdown -f -r -t 5";
Process.Start(proc);
}
My problem is this displays a "Windows will catastrophically restart in 5...4...3..." kind of dialog box, very reminiscent of Blaster, how can I restart windows silently, without any dialogs popping up?
Update: Guys, ugh, it's for an installer, it doesn't "just restart your computer out of nowhere", it finishes installing and then asks you if you want to restart, if you do, then it does, but it doesn't need any crappy system dialog telling you to wait X time before it restarts.
just remove the "-t 5" part from your argument list - and it will immediately restart the computer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With