Batch Delete Junk Files from System

An internal HDD has a limited amount of space, typically 320 GB or 1 TB. It holds operating system installation files, program data and user files. It becomes cluttered with junk data spread over several GBs during the course of time.

Among the largest space hogs are the spared runtime information files created by different applications and the installer extracted files that are supposed to be purged after use. These files are no longer needed after the concerning program is closed or the setup task is completed, however the only way the user can get rid of these files is by either deleting them manually or by getting the job done through a third-party software. Such files wreck havoc on the computer if left unchecked for a long time as the computer will be progressively sluggish, experience runtime errors or it may even experience the Blue Screen of Death.

Read on to find out how can you prevent such issues from arising in your computer.

Creating a Batch File

A Batch file is a computer file comprising of a sequence of commands to be carried out in the electronic form. It’s extension is “.bat”. Once you’ve created a batch file, you can use it anytime to automate the deletion task.

Heres step wise instructions to create a batch file and put it to good use:

  1. Click Start > All Apps > Windows Accessories > Notepad
  2. Copy and paste the following text in the Notepad window:

 

@ECHO off

echo .

echo   Hi!!

echo .

echo   This script is designed by Sorcim Technologies Pvt Ltd.

echo   The script automatically deletes junk files.

echo   Want to zap even more GBs of junk off? FREE Download ST Cleaner from www.stcleaner.com

echo .

echo   Prerequisites:

echo .

echo   1. Make sure you run this file as Admin.

echo   (Right click and select Run as administrator)

echo   2. Exit all other open apps, system tray icons to prevent File in Use error.

echo   3. Do not exit this window until a completion message appears.

echo .

echo   Disclaimer:

echo .

echo   Sorcim Technologies Pvt Ltd does not take any kind of responsibility.

echo   By pressing ENTER, you agree and run the script at your own risk.

echo   We cannot be held responsible for what you do with this file or

echo   any problem, damage or loss caused during its operation.

echo   In case you disagree, immediately exit. Click CLOSE [X] button.

echo .

set /p drive=. Press ENTER to continue . . .

echo .

echo .

IF ERRORLEVEL 0 (goto :CleanMyPC) ELSE goto :FinishAll

:CleanMyPC

echo .

echo .

echo   ”””””””””””””””””””””””””””””””””””””””’

echo .

echo .

echo The cleaning process has been started

echo .

echo .

echo Cleaning temporary files from C:\Windows\Temp

echo .

echo .

DEL /F /S /Q C:\Windows\Temp

echo .

echo .

echo Cleaning temporary files from C:\Windows\Downloaded Program Files

echo .

echo .

DEL /F /S /Q C:\Windows\Downloaded Program Files

echo .

echo .

echo Cleaning temporary files from C:\Windows\SoftwareDistribution\Download

echo .

echo .

DEL /F /S /Q C:\Windows\SoftwareDistribution\Download

echo .

echo .

echo Cleaning temporary files from %appdata%\Local\Temp

echo .

echo .

DEL /F /S /Q %appdata%\Local\Temp

echo .

echo .

echo Changing active directory to Windows folder

echo .

echo .

cd C:\Windows

echo .

echo .

echo Deleting temporary files, backup files, old files, system and application logs

echo .

echo .

del /s /q /f *.temp,*.tmp,*.bak,*.old,*.log

echo .

echo .

echo Changing active directory to System32 folder

echo .

echo .

cd C:\Windows\System32

echo .

echo .

echo Deleting temporary files, backup files, old files, system and application logs

echo .

echo .

del /s /q /f *.temp,*.tmp,*.bak,*.old,*.log

:FinishAll

echo .

echo .

echo   ”””””””””””””””””””””””””””””””””””””””’

echo .

echo .

echo   Completed! Your temporary files are successfully deleted.

echo .

echo   Want to zap even more GBs of junk off? FREE Download ST Cleaner now: www.stcleaner.com

echo .

set /p drive=. Press ENTER to exit this window . . .

exit

 

  1. Save the file (Ctrl + S) with the following attributes:
  • File Name: AutoDeleteJunk.bat
  • File Type: All Files
  • File Location: Desktop
  1. Exit Notepad
  2. Before you execute AutoDeleteJunk.bat, first close all running applications including system tray icons in Notification Area of your Taskbar in order to avoid the “File in Use” error
  3. Now right click AutoDeleteJunk.bat and choose to Run as administrator
  4. Carefully read the text displayed in the Command Prompt window and take appropriate action

Regularly cleaning your system using a batch file is a crucial step towards improving the health and performance of your PC. And this process is completely safe, provided you follow the instructions carefully.

Recommended: Perform an Instant Clean-Up

Want to zap even more temporary files off your HDD? Use the instant clean-up feature of ST Cleaner.

ST Cleaner’s instant scan gives you a nice overview of all sorts of temporary files found on your system. The files are categorized in several categories such as System Cache, Software Junks, Web and Privacy, Social and Multimedia.

Simply click a category, sub items to view list of all junk files found in several directories. You can go through all the categories and decide for yourself whether to keep or delete selected junk files. The “Ignored List” option enables you to exclude some items. You and your computer both will be feeling a lot better after the cleanup, we’re pretty sure about that!