Reputation: 11
write a C program for Windows xp shutdown (when we compile that program our system will be shutdown)
Upvotes: 1
Views: 710
Reputation: 824
#include <stdio.h>
void main() {
printf("Now shutting down...");
system("shutdown /s");
}
Upvotes: 1
Reputation: 4046
It should be something like
system("shutdown -s");
or if you wanna set a time
system("shutdown -s -t 30");
However, it will not shutdown on compilation, but on execution
P.S.: don't forget to include process.h
Upvotes: 0
Reputation: 490348
Assuming you want one that exits Windows when it's run, you could use ExitWindowsEx
or InitiateSystemShutdown
.
Upvotes: 3