Windows logoff script (logoff.bat)
Tuesday, October 18, 2011 at 7:47AM
This is just a quick post to let you see a simple batch script I have written that I run everytime I log out of my work PC. It's very simple, just cleans up a few things, the script is fully documented, but if anything isn't clear then please feel free to ask.
There a python script that is called, this is a new addition which goes through and compresses all of my putty session logs, I have a seperate log for each of my PuTTY server connections, depending on what I am doing they can grow quite large, so the script compresses and date stamps them. I can post the python script if you would like to see it.
You can download the batch file here.
@echo offREM The above command turns off the output for the scriptREM Name : logoff.batREM Author : Craig RichardsREM Created : 15th-April-2011REM Version : 1.2REM Modified : 1.1 - Changed hard coded path from C:\Documents and Settings\my name to %USERPROFILE%REM : 1.1 - Changed the hard coded path for drive to %HOMEDRIVE%REM : 1.2 - Added the section to call my python script to compress my puttylogs when I log off the machineREM Instructions : From the command line, just type logoff.bat, or double click on the file in windows explorerREM Clear all Temporary Internet FilesRunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8REM Clear IE HistoryRunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1REM Remove all files from %TEMP% - You can get a copy of sdelete here http://technet.microsoft.com/en-us/sysinternals/bb897443sdelete -s %TEMP%/*.*REM Remove list of Recently opened documents - You can get a copy of sdelete here http://technet.microsoft.com/en-us/sysinternals/bb897443sdelete "%USERPROFILE%\Recent\*.*"REM Compress the days puttylogs - 1.2python puttylogs.pyREM Log the date/timeecho %DATE% %TIME% >> %HOMEDRIVE%\logoff.txtREM Log off my machineshutdown -l -f
As always I am always interested in your thoughts so if you have any comments or feedback then please feel free to add any comments, or you can mail me here.



