Solved

Customise default "shutdown/restart" behaviour in Windows 10 to run prior commands

I have created two custom .bat files that shutdown/restart the computer, and which beforehand run some other (simple) commands that I want run just before shutting down.

Now I shut down/reboot my computer by doubleclicking these bat files. Not a big deal, but I was wondering whether one could modify the default behaviour of the power buttons in the start menu to do that (by having them running the .bat files, or maybe in some other way having them run the same commands before the do what they do).
3 answers Last reply Best Answer
More about customise default shutdown restart behaviour windows run prior commands
  1. Best answer
    Hi. You could probably run the batch files with the Task Scheduler, but from what I have read, by doing this the batch files need to be really quick or Windows will shut down before they finish. Here are a couple of pages explaining the process:
    https://superuser.com/questions/165142/using-task-scheduler-to-run-a-task-before-shutdown
    https://stackoverflow.com/questions/101647/how-to-schedule-a-task-to-run-when-shutting-down-windows

    If you really must run a longer script, then consider getting the Classic Shell start menu. I've been using it for years and I just tested out using a custom shutdown command and it worked. Here is basically what I did:

    Note: Classic Shell is no longer in development. It's likely that parts of it will begin to stop working with additional Windows updates. The author did release the source code so maybe someone will pick it up and continue development of it.

    Additional ideas from others are welcome.
  2. gardenman said:
    Hi. You could probably run the batch files with the Task Scheduler, but from what I have read, by doing this the batch files need to be really quick or Windows will shut down before they finish. Here are a couple of pages explaining the process:
    https://superuser.com/questions/165142/using-task-scheduler-to-run-a-task-before-shutdown
    https://stackoverflow.com/questions/101647/how-to-schedule-a-task-to-run-when-shutting-down-windows

    If you really must run a longer script, then consider getting the Classic Shell start menu. I've been using it for years and I just tested out using a custom shutdown command and it worked. Here is basically what I did:

    Note: Classic Shell is no longer in development. It's likely that parts of it will begin to stop working with additional Windows updates. The author did release the source code so maybe someone will pick it up and continue development of it.

    Additional ideas from others are welcome.


    Thanks for the thorough answer! The links contain all the information I needed. I used the task scheduler and it seems to work fine (I think). I have a very short script so there does not seem to be any issue.
  3. I'm glad you got it working... Happy computing!
Ask a new question

Read More

windows 10 Default Shutdown