Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to reboot a set of machines each night. If possible I want the applications to have time to cleanly exit. Will shutdown /f allow applications to exit and, if need be, kill them on a timeout? Or will it just start killing processes?

share|improve this question
up vote 2 down vote accepted

First of all, if you want to reboot you will need shutdown /r /f. This will give users 1 minute to complete their work. If you want to reboot immediately you can use shutdown /r /f /t 0. Note the /t 0 is the timeout before the shutdown begins. It is not the time the application has to shut down.

At shutdown there is a signal being send to the applications. I tested this with an editor open. I got a save message. It stayed there for 2 seconds after which the process was killed off (hard !!).

If your application does not need user interaction, it has 2 seconds. If it does need user interaction, and the user does nothing, the process is terminated.

If you want to change some of the time-outs you can try changing the registry keys found on this page and this page. I tried the WaitToKillAppTimeout and HungAppTimeout but it keeps terminating after 2-3 seconds.

share|improve this answer

Well, shutdown /f would do a forced shutdown not a reboot. I think that you would want shutdown /r /f which would force a reboot. It would send a kill command to the apps. What they do with the command would depend on the app.

share|improve this answer
    
What if the app doesn't exit right away? Is the a defined length of time it gets to exit? If the apps get a choice of what to do, how is it any different from a shutdown without /f? – TwistedTech Sep 19 '13 at 19:33
    
The app doesn't get a choice. /f Forces running applications to close without forewarning users.. So it's just a kill command. The application doesn't have the possibility to do anything. If you have applications which need time to shutdown you should call a script to send a close request to all apps before doing a shutdown /f. – Rik Sep 19 '13 at 19:57
    
Also, Shutdown /f may not do anything... If memory serves at least. A shutdown would be shutdown /s , reboot is /r and log off is /l. – AthomSfere Sep 19 '13 at 20:18
    
Just tested it and shutdown /f does a logoff. I had an editor open and it gave me a save option. But before i could click it the editor closed (without saving). So, there is a signal being send to the application with a time-out of about 2 seconds. I think this is editable in the registry. (It is the same process as logoff) – Rik Sep 19 '13 at 20:27
    
@Rik, do you have any evidence to back up your claims? AFAIK when Windows starts a shutdown it posts the WM_QUERYENDSESSION message to all applications which gives them an opportunity to shutdown cleanly or even stop the shutdown sequence. From MSDN – heavyd Sep 19 '13 at 20:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .