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 |
04 | main() |
05 | { |
06 | char ch; |
07 |
08 | printf ( "Do you want to shutdown your computer now (y/n)\n" ); |
09 | scanf ( "%c" ,&ch); |
10 |
11 | if (ch == 'y' || ch == 'Y' ) |
12 | system ( "C:\\WINDOWS\\System32\\shutdown /s" ); |
13 |
14 | return 0; |
15 | } |