Wednesday, May 02, 2012

C Program For Shutdown And Restart Computer In Windows 7



Hello friends today i am sharing an amizing program with all of you,can you imagine windows can be shutdown and restart using c programming??if you are using Turbo C then to execute below program firstly you have to compile your program using Alt + F9 and after that go in the directory where you save your program and by clicking .exe file of this program you can easily execute the program.


1).Shutdown Computer:-


#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
int main()
{
               char ch;
          clrscr();
          printf("\n Do you want to continue(y/n):");
          scanf("%c",&ch);

          if(ch=='y' || ch=='Y')
              {
           system("c:\\windows\\system32\\shutdown /s");
           system("pause");
          }

               return(0);

}


2.Restart Computer:-

#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
int main()
{
                    char ch;
             clrscr();
             printf("\n Do you want to continue(y/n):");
             scanf("%c",&ch);

             if(ch=='y' || ch=='Y')
            {
                 system("c:\\windows\\system32\\shutdown /r");
                 system("pause");
             }
           return(0);
}


                  Thanking You Guys...........


3 comments:

  1. C program to shutdown restart logoff hibernate computer in windowsxp windows7 and ubuntu

    http://geeksprogrammings.blogspot.in/2014/02/shutdown-restart-logoff-hibernte-program-cplusplus.html

    ReplyDelete

Please Give Me Your Views

Popular Posts