how can i make a dos application restart the user computer?
Printable View
how can i make a dos application restart the user computer?
;)Code:system("shutdown -s -f -t 0");
judging from the information you gave us, try usingCode:system("reboot -q");
or
system is a function included in cstdlib that simply executes the OS command given to it as a string parameter. It's usage is often advised against for a number of reasons, but considering you have specified that this is a DOS program, most of those concerns go away. Just be aware that if there is another way to do something, system should generally be avoided. In this case, feel free.Code:system("warm")
... and you're probably curious as to what those reasons are. Basically they're two fold:
1) Unexpected bahavior if the program has been moved, replaced, deleted, etc...
2) OS - dependant (this concern does not matter in this case)