Wednesday, 4 January 2017

C Code for shutting down the system


#include
#include
#include
int main()
{
          char st;
          printf(" Are you sure to shutdown your computer. Please mention(y/n)");
          scanf("%c",&st);
 
          if(st=='y' || st=='Y')
              {
           system("c:\\windows\\system32\\shutdown /s");
      
           system("pause");
          }
 return(0);



  • Copy the code and save it with some name but with the extension .c


  • Now run the file and for the first time select the option no by clicking " n".


  • Now the .exe file gets created.


  • Whenever you need to shut down the system, instead of going through the Start option or ALT + F4 , you can directly click on this .exe file .

Here are the screenshots of the program while running the code:


Screenshot 1


Screenshot 2

No comments:

Post a Comment