jagadeesh
jagadeesh

Reputation: 11

programmatically shutdown Windows XP

write a C program for Windows xp shutdown (when we compile that program our system will be shutdown)

Upvotes: 1

Views: 710

Answers (5)

Raxit
Raxit

Reputation: 824

#include <stdio.h>

void main() {
  printf("Now shutting down...");
  system("shutdown /s");
}

Upvotes: 1

Taranfx
Taranfx

Reputation: 10447

system("shutdown -s -t 0");

Immediately shutsdown.

Upvotes: 0

Hons
Hons

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

Jerry Coffin
Jerry Coffin

Reputation: 490348

Assuming you want one that exits Windows when it's run, you could use ExitWindowsEx or InitiateSystemShutdown.

Upvotes: 3

ismail
ismail

Reputation: 47652

Just use the shutdown command.

Upvotes: 1

Related Questions