Preparing to install a new application and noticed that I did not have enough room.
And, so what to do ….
- Quickly looked for the biggest files
- The biggest file happens to C:\Windows\Logs\cbs\cbs.log
- Who owns this file….again, not sure … but need to find out quickly
- As it is has the .log extension, knew that I can look at its content
- Type c:\windows\logs\cbs\cbs.log | more
- cbs.log reads “Starting Trusted Installer”
Who needs Trusted Installer? You ‘re out of here!
Delete files automatically – CAB files and CBS log issues
@echo off for /f %%A in ('dir c:\windows\temp\cab_*^| find "File(s)"') do set cnt=%%A echo File count = %cnt% if %cnt% gtr 100 goto :bigger goto :end :bigger rem "Cleaning up some stuff" del c:\windows\temp\cab_* rem "Delete old *.tmp files" forfiles /P "c:\windows\temp" /S /M *.tmp /C "cmd /c del /F /Q @path" /D -30 rem Delete oldest log file in c:\windows\logs\cbs setlocal set Folder=c:\windows\Logs\CBS set FileMask=*.log set OldestFile= for /f "delims=" %%a in ('dir /b /o:d "%Folder%\%FileMask%" 2^>NUL') do ( set OldestFile=%%a goto Break ) :Break if "%OldestFile%"=="" ( echo No files found in '%Folder%' matching '%FileMask%'! ) else ( del "%Folder%\%OldestFile%" ) :end __EOF