If you want to perform some tasks or run scripts everytime you logoff in Windows 7, then it is very easy to do. This can be useful if you want to perform tasks like cleaning internet history, deleting some folders, copying some files each time you log off in Windows. This is also handy for creating regular backups of your important files. You can add scripts to run everytime at logoff using the Group Policy Editor in Windows 7. Here is how :
- First of all, create the a batch file (to be used as a script) and save it. You can add commands in this batch file to run other programs or perform some tasks. It is better to use automated programs which close down themselves after performing the intended tasks. For example, if you want to copy files from C:\Download to C:\PDF each time you log off, then the batch script would be as follows :
Copy C:\Download*.* C:\PDF
We save the script file as C:\Scripts\logoff.bat.
- Press the key combination Windows logo key + R to open the Run dialog.
- In the Run Dialog, type gpedit.msc and press Enter to open the Group Policy Editor.
- In the Group Policy Editor, open User Configuration → Windows Settings → Scripts (Logon/Logoff) as shown.
- Double-click on Logoff in the right side pane. In the window that opens up, click on the Add button.
- Browse to your script file and put in any parameter if it accepts parameters. Then click OK button.
- Click OK to close the Logoff Properties window.
That’s it. Now each time you logoff in Windows 7, the logoff script that you have added will run automatically before Windows logs you off. You can add as many scripts as you want – they will all run one after the another as you logoff.