0

I want to shutdown my windows 7/xp after 30 min automatically by using shortcut, how do i create shortcut which will ask me time limit and after that time limit it will shutdown windows 7/xp automatically.

3
  • A shortcut alone cannot do that. The shortcut needs to run a separate application that then prompts you, then keeps track of the time, and issues the shutdown when appropriate.
    – Remy Lebeau
    Jun 27, 2013 at 18:07
  • This is not a programming question, and is off-topic here. Operating system and general computer questions belong on Super User instead.
    – Ken White
    Jun 27, 2013 at 19:40
  • You can write a batch file for this, or else there are lots of GUI apps that allow you to specify the time to shutdown/sleep/logoff/whatever.
    – Karan
    Jun 27, 2013 at 22:04

2 Answers 2

1

Even easier way to do it:
Create a shortcut with the target: shutdown /s /f /t 1800

That will cause the computer to reboot after 1800 seconds, and also to force any open applications to close (WARNING: The /f switch will cause you to lose any unsaved data). I use something similar to reboot my work laptop and servers remotely, using this same command.

2
  • 1
    You may want to to add the /f switch to force open applications to shutdown. From a command prompt run shutdown /? to see all the switches.
    – Keltari
    Jun 28, 2013 at 14:30
  • @Keltari That is an excellent suggestion, I'll update my answer with that information.
    – Taegost
    Jun 28, 2013 at 14:40
0

Compile this C program and and the exe file is the one that you are looking for.. if u like this select this as answer..

#include <time.h>
#include <stdio.h>
main() { 
    int hour,minutes;
    long int total;
    printf("\nEnter the no.of.hours and minutes for shuting down:");
    scanf(" %d %d",&hour,&minutes);
    total = hour*60*60 + minutes*60; 
    sleep(total);
    system("C:\\windows\\system32\\shutdown /s /t 10");
    return 0;
}

You must log in to answer this question.