Friday, 11 May 2012

Shutdown / Restart pc using c program

You can shutdown or restart your pc using a simple c program

//shutdown: for windows7
#include <stdio.h>
#include <stdlib.h>
main()
{
    system("C:\\WINDOWS\\System32\\shutdown /s");
return 0;
}

//shutdown: for xp
#include <stdio.h>
#include <stdlib.h>
main()
{
    system("C:\\WINDOWS\\System32\\shutdown -s");
 return 0;
}




//shutdown: for linux
#include <stdio.h>
 
int main() {
  system("shutdown -P now");
  return 0;
}

 

//restart: for windows7 users
#include <stdio.h>
#include <stdlib.h>
main()
{
    system("C:\\WINDOWS\\System32\\shutdown /r");
return 0;
}



No comments:

Post a Comment