Click here to Skip to main content
15,900,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Guys,

I want to restart Computer when my application installation complete

I am using c#.net

Please help me,

Thank you
Posted

1 solution

Perhaps the simplest way:
C#
System.Diagnostics.Process.Start("ShutDown", "/r");


Run ShutDown /? to see other options.

—SA
 
Share this answer
 
v2
Comments
VJ Reddy 12-Apr-12 20:22pm    
Nice answer. 5!
Sergey Alexandrovich Kryukov 12-Apr-12 20:40pm    
Thank you, VJ.
--SA
Sumit Kumar Singh India 13-Apr-12 1:59am    
Could you tell me where write this code
Sergey Alexandrovich Kryukov 13-Apr-12 11:13am    
Anywhere you want to initiate the restart; it can work at any moment. :-)
Try it -- it only schedules restart in a certain time span, which you can also choose using /t seconds parameter; you can force application termination using /f parameter (by default if duration > 0) -- anyway, I told you to look at the help on this command using ShutDown /?.

If you agree that it makes sense, please accept the answer formally (green line) -- thanks.
--SA
Sumit Kumar Singh India 13-Apr-12 11:22am    
Thank you so much!! Its working fine.

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