How To Shutdown Windows XP Using C Language

How To Shutdown Windows XP Using C Language

In this tutorial we will learn How To Shutdown Windows XP Using C Language.Here we will write a program in C language to shutdown your Windows XP system.I have written How To Shutdown Windows 7 Using C Language.It will ask for your input, if your input is “YES”(y,Y) then it will shutdown your system.

Code:

#include <stdio.h>
#include <stdlib.h>

main()
{
char ch;

printf("Do you want to shutdown your computer now (y/n)\n");
scanf("%c",&ch);

if (ch == 'y' || ch == 'Y')
system("C:\\WINDOWS\\System32\\shutdown -s");

return 0;
}