Can someone tell me what text I need to type to create a batch file that would delete the following folders because I have fixed all my event log errors so far with the exception of the indexing error:
Upon doing some search, I found that CCleaner may be behind this so I wanna try a format without ever using CCleaner
PS: Re-building the Index doesn't help
What I want the batch file to delete is the following:
1) C:\Windows\Temp (delete all the files and folders in that folder but not the folder itself)
2) C:\Users\MYUSERNAME\AppData\Local\Temp (delete all the files and folders in that folder but not the folder itself)
3) C:\Windows\SoftwareDistribution\Download (delete all the files and folders in that folder but not the folder itself)
Thanks
-
Spartan@HIDevolution Company Representative
-
Spartan@HIDevolution Company Representative
-
Spartan@HIDevolution Company Representative
-
Spartan@HIDevolution Company Representative
it didn't do a thing -
Spartan@HIDevolution Company Representative
Then I right clicked on it and chose Run As Admin, not a single file got deleted, what's going on -
Personally I have been using this for a year or so on an monthly basis (right before my monthly full images) Disk Cleanup : Extended - Windows 7 Help Forums
-
John Ratsey Moderately inquisitive Super Moderator
-
Spartan@HIDevolution Company Representative
-
Spartan@HIDevolution Company Representative
Finally got it! A guy from MDL forums gave me the text I would have never been able to figure it out! Tested it and working perfectly to remove the files from USER Temps + Software Distribution Download Folder (Temp Windows Update Files) + Windows Temp files
Paste this in a text file and rename it to whatever you want.bat and run it as admin!
Code:DEL /S /F /Q "%temp%\*" 1>nul 2>nul DEL /S /F /Q %systemroot%\temp\* 1>nul 2>nul DEL /S /F /Q %systemroot%\SoftwareDistribution\Download\* 1>nul 2>nul for /f %%i in ('"dir /s /b /ad "%temp%"" 2^>nul') do RD /S /Q %%i 1>nul 2>nul for /f %%i in ('"dir /s /b /ad %windir%\temp" 2^>nul') do RD /S /Q %%i 1>nul 2>nul for /f %%i in ('"dir /s /b /ad %windir%\SoftwareDistribution\Download" 2^>nul') do RD /S /Q %%i 1>nul 2>nul
-
Just use Windows Disk Cleanup or Ccleaner or Glary Utilities. I find Glary is the most thorough. They all have a reasonably intuitive GUI and most importantly all free. No need to use a batch file when these apps do the same and better.
-
Spartan@HIDevolution Company Representative
Here is a more advanced batch script that cleans out more folders (got it from MDL forums and works great):
Code:[b]@echo off title . color 1F openfiles >nul 2>&1 if %errorlevel% NEQ 0 goto :UACPrompt goto :gotAdmin :UACPrompt echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" echo UAC.ShellExecute "%~fs0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" exit /b :gotAdmin DEL /S /F /Q "%temp%\*" 1>nul 2>nul DEL /S /F /Q %systemroot%\temp\* 1>nul 2>nul DEL /S /F /Q %systemroot%\inf\*.log 1>nul 2>nul DEL /S /F /Q %systemroot%\Logs\CBS\* 1>nul 2>nul DEL /S /F /Q %systemroot%\Logs\DPX\* 1>nul 2>nul DEL /S /F /Q %systemroot%\Logs\DISM\* 1>nul 2>nul DEL /S /F /Q %systemroot%\Microsoft.NET\Framework\v2.0.50727\*.log 1>nul 2>nul DEL /S /F /Q %systemroot%\Microsoft.NET\Framework\v4.0.30319\*.log 1>nul 2>nul if exist %systemroot%\SysWOW64\cmd.exe DEL /S /F /Q %systemroot%\Microsoft.NET\Framework64\v2.0.50727\*.log 1>nul 2>nul if exist %systemroot%\SysWOW64\cmd.exe DEL /S /F /Q %systemroot%\Microsoft.NET\Framework64\v4.0.30319\*.log 1>nul 2>nul DEL /S /F /Q %systemroot%\SoftwareDistribution\Download\* 1>nul 2>nul RD /S /Q "%LocalAppData%\Microsoft\Windows\WER\ReportQueue" 1>nul 2>nul for /f %%i in ('"dir /s /b /ad "%temp%"" 2^>nul') do RD /S /Q %%i 1>nul 2>nul for /f %%i in ('"dir /s /b /ad %windir%\SoftwareDistribution\Download" 2^>nul') do RD /S /Q %%i 1>nul 2>nul for /f %%i in ('"dir /s /b /ad %windir%\temp" 2^>nul') do RD /S /Q %%i 1>nul 2>nul[/b]
Help me make a batch file to clean temp files
Discussion in 'Windows OS and Software' started by Spartan@HIDevolution, Oct 28, 2014.