Hi,
You may try the below code.
var psi = new ProcessStartInfo("shutdown","/s /t 0");
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
Process.Start(psi);
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I want to make an application that runs scripts that automate basic troubleshooting steps. i want it to restart the computer first and foremost. after it reboots i want it to continue with the rest of the scripts. if you can explain to me how to make that happen i would appreciate it. i would prefer to use C# for this but at this point i will use anything that works.
Hi,
You may try the below code.
var psi = new ProcessStartInfo("shutdown","/s /t 0");
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
Process.Start(psi);
Hi @Darryl Weeks ,
You can write below line of code to restart using C#.
System.Diagnostics.Process.Start("shutdown", "/s /t 0")
------------------------------------------------------------------
Please vote up and Accept as an Answer if my reply is helpful
Maybe you can use the RunOnce key to execute the rest of your scripts after a restart.