5

I'm trying to edit a notepad's .txt on the desktop, and then restart

Normally, when I press the restart button from the start menu, it allows me to save the .txt file

save notapad txt

And then it shows a screen asking if I want to force applications to close

proper shutdown

This is absolutely NORMAL..

But when I use command line or batch files, it does not allow me to close/save applications, and there is no force screen... It restarts the system without saving files...

I'm trying to use these commands with no success:

shutdown /r

and

shutdown /r /t 10 /c "this is a comment"

Please tell me what I'm doing wrong?

2 Answers 2

1

That’s because using a timeout implies /f. From shutdown /?:

/t xxx     Set the time-out period before shutdown to xxx seconds.
           The valid range is 0-315360000 (10 years), with a default of 30.
           If the timeout period is greater than 0, the /f parameter is
           implied.

(Emphasis mine)

/f means:

/f         Force running applications to close without forewarning users.
           The /f parameter is implied when a value greater than 0 is
           specified for the /t parameter.

This behavior cannot be changed. However, the user will be notified that a shutdown/reboot/logoff event is imminent:

enter image description here
(On Windows 10. Earlier versions had balloon tips IIRC.)

Whether they choose to act appropriately is another question of course.

1
  • Great answer, most detailed and is correct. Nobody reads the help messages.
    – coresdev
    Sep 1, 2020 at 13:41
0

Your timeout is probably too short. 10 seconds isn't long enough for Windows to generate and display a prompt before shutdown. Try bumping that up to 300 (5 minutes) and test nudging it down to get the delay you prefer.

BTW, I think Win8 (maybe 7 as well) displays this as a bubble notification instead of a good ol' fashioned dialogue so pay attention to that. HTH

You must log in to answer this question.

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