Have it perform some simple tasks before shutting down your system for the day.
I have made a simple batch file to run a system defrag, then make a registry backup before shutting down the system for the night.
Here is what the batch file looks like:
defrag C:
regedit /e c:\regbackup.reg
shutdown -s
Save the file as myshutdown.cmd (or anything you want), save it somewhere on your drive, then you can make a shortcut to the file on the desktop.
Then right click on the new shortcut on your desktop and change the icon to look like the shutdown icon.
So now at the end of the day, activate your new shutdown command and it will defrag your drive, create a registry backup and shutdown your computer.
If you can think of any other maintenance tasks to add to the shutdown script, leave a comment and maybe it can be added in to make the ultimate shutdown command.



I doubt that a defrag is a great example of a pre-shutdown task given how long it could take.
The ultimate shutdown command would be as immediate as possible IMO. Personally I tend to leave my PCs on all the time, and hibernate my laptop. If I had a solid state drive the hibernate and wake-up process would be almost immediate.
Housekeeping tasks probably make the most sense for a pre-shutdown script, but there are perhaps better ways to perform them.
That is a good point, but I usually just shutdown at the end of the day, so for me it doesn’t matter how long it takes… I just hit shutdown task and walk away from it.