|
-
Oct 31st, 2006, 01:27 AM
#1
Thread Starter
Addicted Member
[2005] restart computer
how do i restart computer programatically in .NET 2.0 / VS 2005
Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water
Huzefa Yousuf
Software Engineer
Verticity Inc.
+92-345-2235303
[email protected]
-
Oct 31st, 2006, 01:29 AM
#2
Re: [2005] restart computer
Multiple examples already posted on the forum. Execute shutdown.exe from the system32 folder with the appropriate commandline arguments or use the ExitWindowsEx API.
-
Oct 31st, 2006, 01:34 AM
#3
Thread Starter
Addicted Member
Re: [2005] restart computer
i have already used the Shutdown.exe code
System.Diagnostics.Process.Start("Shutdown", "/r")
but it takes 30 seconds before proceeding, i want it to be direct
can u pls give me the example of the ExitWindow API that u were referring to
Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water
Huzefa Yousuf
Software Engineer
Verticity Inc.
+92-345-2235303
[email protected]
-
Oct 31st, 2006, 01:51 AM
#4
Re: [2005] restart computer
Shutdown.exe will NOT take 30 seconds if you pass it the correct commandline parameters. Read the Windows help topic for it and that explains all the commandline parameters, or else do the standard for Windows commandline apps that require commandline parameters and use the command prompt itself to get help. If you enter "shutdown" into a command prompt with no commandline parameters or with the "/?" switch it will tell you what all the accepted commandline parameters are.
As for ExitWindowsEx, as I said, there are already multiple examples posted on the forum so I'm not going to add another.
-
Oct 31st, 2006, 02:35 AM
#5
Re: [2005] restart computer
You can also simply crash it using some handy critical service. It'd take less than a second so you have a choice between a speedy restart or a safe recovery.
-
Oct 31st, 2006, 02:06 PM
#6
Hyperactive Member
Re: [2005] restart computer
you can use System.Diagnostics.Process.Start("Shutdown", "/r /t 00") which will set the timer to 00 and instant restart.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|