Categories
Technology - Tips

How To Shutdown Windows 7 Using C Language

How To Shutdown Windows 7 Using C Language

In this tutorial we will learn How To Shutdown Windows 7 Using C Language.Here we will write a program in C language to shutdown your Windows 7 system.Earlier i have written How To Shutdown Windows XP 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;
}

Comments are closed.