I'm trying to make an application that shutdown my laptop using a simple button but when I press the button the shutdown still has to work.
Is this possible to do? And how do I have to do it? Or is this an automatic process?
I think the code should look like this:
Private sub
Button1_click(ByVal...)
Shell("shutdown /s")
End sub
Can someone please give me feedback if I used it correct?
Thank You
To restart or shutdown your computer via .net you should use process.start to run your command:
System.Diagnostics.Process.Start
In this case you need to run the shutdown command for example this option will restart your computer after a 30 second delay.
System.Diagnostics.Process.Start("ShutDown", "/r");
Update to answer adicional questions:
/t x
(x in seconds), for example /t 60
would delay the shutdown in 60 seconds.shutdown -a
in cmdMore information about the shutdown command: