Command for auto reboot – Windows 7

145 pts.
Tags:
Microsoft Windows 7
Reboot
Windows 7 Administration
Windows scripting
I am trying to set up an auto-reboot script to reboot my Windows 7 workstations. I have the following command set up as a batch file and set up to run using task scheduler:

shutdown.exe /r

If I have an open document with changes that have not been saved, the command I have used will not save the recent changes to the document but will prompt me to save. Is there a command that I can add to this string to save the changes to the document before the workstation reboots.

Any help with this would be greatly appreciated.



Software/Hardware used:
Windows 7

Answer Wiki

Thanks. We'll let you know when a new response is added.

The SHUTDOWN command does not have the capability to tell applications to save data and close.

You can use “/r” for reboot which will trigger open applications to prompt to save data and not reboot if the applications remain open.

Adding the “/f” will force a reboot but cause potential data loss because it forces applications closed without saving data. A workaround is to have applications that save recovery information or autosave in the background. Not always a good solution.

The issue with telling an application that has changed data to save the data is what to do. In the case that no save file has been created how does it know what file name to use and where to save? In the case where the changes should be discarded instead of saved how will it determine that? In the case that changes just need to be saved how will it know that?

There is no good best solution for running applications with open files. Not leaving files open with unsaved changes when you leave the computer provides decent protection. Then a reboot will not usually loose data.

The best possible solution is when you leave nothing open because you know a reboot is scheduled.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Mariodlg
    Did you tried shutdown /r /f /f forces windows to shutdown without warning.
    2,790 pointsBadges:
    report
  • ErroneousGiant
    open the command prompt and type 'shutdown /?' to see all of your available options for this function. I don't think you'll need it in a batch file as i think you can just put it in scheduled tasks as is.
    3,120 pointsBadges:
    report
  • orangehat
    We are on a domain and we run it from a server so the user's can't stop it or disable it. add \machinename to the batch file and set it up as a task but the .bat and task are on the server. We have user's who won't shutdown their machine and this way we jam it down their throats.
    1,720 pointsBadges:
    report
  • EFeliciano
    "/c" will allow you to display a prompt advising the user you have scheduled a reboot. One problem with setting up a scheduled reboot of this kind is that the user might be changing his finished document. The auto save might save text the end user did not want saved and possibly leaving you with the repercussions. Best way to accomplish this task is advise all users to save their documents because you will automate a reboot on all machines which will cause all unsaved work to be deleted. The end user will be fully aware that they might loose their work if they do not take the steps to save.
    520 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following