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:

01#include <stdio.h>
02#include <stdlib.h>
03 
04main()
05{
06char ch;
07 
08printf("Do you want to shutdown your computer now (y/n)\n");
09scanf("%c",&ch);
10 
11if (ch == 'y' || ch == 'Y')
12system("C:\\WINDOWS\\System32\\shutdown /s");
13 
14return 0;
15}

Comments are closed.