Shutdown Computer Through C Program.
-
hello all, I have been trying to make a program to shutdown my computer, i have the program on a timer and at a certian time i would like the program to shutdown my whole computer. i am planning on using it for when i am Burning dvds or listening to music before bed. i know that the command prompt has a command to shutdown a computer: /shutdown -s where u can also use [-t XX] where XX is the time till it shutdowns. Can someone please help me in this, either by using C to open and use command prompt by itself, or another way. Thank you Very much. - Droz - ___ ___ /\/\ /\ | |
-
hello all, I have been trying to make a program to shutdown my computer, i have the program on a timer and at a certian time i would like the program to shutdown my whole computer. i am planning on using it for when i am Burning dvds or listening to music before bed. i know that the command prompt has a command to shutdown a computer: /shutdown -s where u can also use [-t XX] where XX is the time till it shutdowns. Can someone please help me in this, either by using C to open and use command prompt by itself, or another way. Thank you Very much. - Droz - ___ ___ /\/\ /\ | |
In C#, you could simply call:
System.Diagnostic.Process.Start("shutdown.exe", "-s -f -t 00");
For more info, check this out: click here. - It's easier to make than to correct a mistake.
-
In C#, you could simply call:
System.Diagnostic.Process.Start("shutdown.exe", "-s -f -t 00");
For more info, check this out: click here. - It's easier to make than to correct a mistake.
-
Thank you so so very much. First time using this site and very impressed with the quick responce. Thank you Jun Du. - Droz - ___ ___ /\/\ /\ | |
-
You're welcome. Glad my answer is helpful. - It's easier to make than to correct a mistake.
Sorry to bother u even more, i ams ure u are very busy. but if it isn't to difficult, is there a way to send the app to my notification area? Atm it is on my taskbar. If this requires a lot of coding and is very difficult please just skip this:) i do not want you to spend all your time on me. Thank you very much Jun Du. - Droz - ___ ___ /\/\ /\ | |
-
Sorry to bother u even more, i ams ure u are very busy. but if it isn't to difficult, is there a way to send the app to my notification area? Atm it is on my taskbar. If this requires a lot of coding and is very difficult please just skip this:) i do not want you to spend all your time on me. Thank you very much Jun Du. - Droz - ___ ___ /\/\ /\ | |
-
oh sorry again, just at work atm and can not try out that code string u recommended i try. That is striaght C code right? Sorry if this is a dumb question, i am new to C coding and only been doing it for about 8 month. - Droz - ___ ___ /\/\ /\ | |
-
hello all, I have been trying to make a program to shutdown my computer, i have the program on a timer and at a certian time i would like the program to shutdown my whole computer. i am planning on using it for when i am Burning dvds or listening to music before bed. i know that the command prompt has a command to shutdown a computer: /shutdown -s where u can also use [-t XX] where XX is the time till it shutdowns. Can someone please help me in this, either by using C to open and use command prompt by itself, or another way. Thank you Very much. - Droz - ___ ___ /\/\ /\ | |
-
hello all, I have been trying to make a program to shutdown my computer, i have the program on a timer and at a certian time i would like the program to shutdown my whole computer. i am planning on using it for when i am Burning dvds or listening to music before bed. i know that the command prompt has a command to shutdown a computer: /shutdown -s where u can also use [-t XX] where XX is the time till it shutdowns. Can someone please help me in this, either by using C to open and use command prompt by itself, or another way. Thank you Very much. - Droz - ___ ___ /\/\ /\ | |
Though you are in the wrong forum, I will try. First of all, why this obsession with C? Why not a BAT file that has "/shutdown -s" typed in it, and use Windows Scheduler to run it whenevr you want? OK, so you are the "I will write my own program" kind of addict. Why not use the
WinExec()
Win32 API to execute the same BAT file? Create the BAT file and keep it somewhere on the hard disk. Now in the C program (which can take parameters like timer duration etc - that is your design, you can even pass the full path & name of theBAT file if you want your program to be generic) that will simply execute the BAT file at the specified time. Koushik Biswas