Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is the code for shutting down the computer.
C#
System.Diagnostics.Process.Start("shutdown","/s /t 0");


What is the meaning of ["/s /t 0"] ?

Similarly can i logoff or restart my computer ?
Posted

1 solution

I found a great description of this on StackOverflow:
Here's how to do the shutdown functions via a batch file:
shutdown -r — restarts
shutdown -s — shutsdown
shutdown -l — logoff
shutdown -t xx — where xx is number of seconds to wait till shutdown/restart/logoff
shutdown -i — gives you a dialog box to fill in what function you want to use
shutdown -a — aborts the previous shutdown command....very handy!

Additional options:
-f — force the selected action

http://stackoverflow.com/questions/162304/how-do-i-shutdown-restart-logoff-windows-via-bat-file[^]

Soren Madsen
 
Share this answer
 
Comments
BillWoodruff 7-Jan-15 22:24pm    
+5
SoMad 8-Jan-15 3:28am    
:-)
Sergey Alexandrovich Kryukov 1-Apr-15 12:08pm    
5ed. Also, there are original Microsoft sources :-)
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900