Jun 5, 2006 #1 E ehsanelahimirza Full Member level 6 Joined Feb 24, 2006 Messages 334 Helped 28 Reputation 56 Reaction score 7 Trophy points 1,298 Activity points 3,570 shutdown restar in c++ hi all plz tell me what commands r used to shutdown or restart a pc in c++ plz give me the syntax with some example
shutdown restar in c++ hi all plz tell me what commands r used to shutdown or restart a pc in c++ plz give me the syntax with some example
Jun 8, 2006 #2 S slavko Member level 2 Joined Sep 1, 2004 Messages 46 Helped 7 Reputation 14 Reaction score 0 Trophy points 1,286 Activity points 369 shutdown restar in c++ you can use the next: Code: system ( "shutdown -s" ) for shutdown pc and Code: system ( "shutdown -r") for restarting a pc also you can specify the time for shutdown pc: Code: system ( "shutdown -s -t 3600" ) this code will shutdown pc after 1h here is an example: Code: #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { system("shutdown -s -t 3600"); system("PAUSE"); return EXIT_SUCCESS; } this will shutdown pc after 1h
shutdown restar in c++ you can use the next: Code: system ( "shutdown -s" ) for shutdown pc and Code: system ( "shutdown -r") for restarting a pc also you can specify the time for shutdown pc: Code: system ( "shutdown -s -t 3600" ) this code will shutdown pc after 1h here is an example: Code: #include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { system("shutdown -s -t 3600"); system("PAUSE"); return EXIT_SUCCESS; } this will shutdown pc after 1h