Windows: To automate some routine tasks that nobody likes doing during the day, you can use Group Policy Editor to make your PC run a script when you shut it down or log off a user account.
To set up a script to run as soon as you shut down your PC, follow these instructions:
- Open GPE by entering “gpedit.msc” (no quotes) into the Run dialog (Win+R).
- In the left panel, select “Windows Settings” under “Computer Configuration”.
- Double-click “Scripts (Startup/Shutdown)” in the right panel.
- Double-click “Shutdown”
- Click “Add…”
- Navigate to the folder containing the script you want to run.
- Click “OK”.
You can also use this method to run scripts when logging out of a user profile. This is handy for performing regular maintenance tasks, cleaning up your workspace or simply running apps that you don’t want running while you’re using your machine. Unfortunately, the Group Policy Editor is only available on Professional or Ultimate versions of Windows.
Nifty Way to Automatically Run a Windows Script or Program Whenever You Turn Off the PC [Gizmo’s Freeware]