Clean up batch of garbage files for Windows Server _dos/bat

Source: Internet
Author: User
Tags prefetch
Copy Code code as follows:

@echo off
Echo is cleaning up the system garbage file, please wait a moment ...
del/f/s/q%systemdrive%\*.tmp
del/f/s/q%SYSTEMDRIVE%\*._MP
del/f/s/q%systemdrive%\*.log
del/f/s/q%systemdrive%\*.gid
del/f/s/q%systemdrive%\*.chk
del/f/s/q%systemdrive%\*.old
del/f/s/q%systemdrive%\recycled\*.*
del/f/s/q%windir%\*.bak
del/f/s/q%windir%\prefetch\*.*
RD/S/q%windir%\temp & MD%windir%\temp
del/f/q%userprofile%\cookies\*.*
del/f/q%userprofile%\recent\*.*
del/f/s/q "%userprofile%\local settings\temporary Internet files\*.*"
del/f/s/q "%USERPROFILE%\Local settings\temp\*.*"
del/f/s/q "%userprofile%\recent\*.*"
echo Cleanup system garbage complete!
Echo. & Pause

Save as a bat suffix is ok.
Practical Application Value:
Excessive log and garbage files on server bursts affect the normal running of IIS, too much junk files can affect server running speed
As a server management and maintenance personnel, it is recommended to do the cleaning of garbage files.
detailed instructions below
@echo off (do not show subsequent commands and current command line)
ECHO is clearing the system garbage file, please wait ... (screen shows "purging System junk files, please wait ...")
del/f/s/q%systemdrive%\*.tmp (forcibly deletes the system to a file with the. tmp extension in the root directory of the disk)
del/f/s/q%systemdrive%\*._mp (forcibly deletes the system to a file with a. _mp extension in the root directory of the disk)
del/f/s/q%systemdrive%\*.log (forcibly deletes the system to a file with a. log extension in the root directory of the disk)
del/f/s/q%systemdrive%\*.gid (forcibly delete system count files with a. gid extension in the root directory of the disk)
del/f/s/q%systemdrive%\*.chk (forcibly deletes the system to a file with the. chk extension in the disk root directory)
del/f/s/q%systemdrive%\*.old (forcibly delete system count files with an. old extension in the root directory of the disk)
del/f/s/q%systemdrive%\recycled\*.* (Empty the Recycle Bin, if the Recycle Bin empty, this sentence is not really useful)
del/f/s/q%windir%\*.bak (forcibly deletes files with the. bak extension in the directory of the currently-launched system)
del/f/s/q%windir%\prefetch\*.* (forcibly deletes all files in prefetch folder in the directory of the currently-launched system)
RD/S/q%windir%\temp & MD%windir%\temp (Delete the Temp folder in the system and create a new temp folder)
del/f/q%userprofile%\cookies\*.* (deletes all files in the Cookies folder in the current User folder)
del/f/q%userprofile%\recent\*.* (deletes all files in the recent folder in the current User folder)
del/f/s/q "%userprofile%\local settings\temporary Internet files\*.*" (delete the local settings\temporary Internet Fil in the current user folder) All files in es\)
del/f/s/q "%userprofile%\local settings\temp\*.*" (Delete all files in Localsettings\temp\ in the current user folder)
del/f/s/q "%userprofile%\recent\*.*" (deletes all files in the recent folder in the current User folder)
echo Clears system garbage complete! (screen shows "Clean System garbage Complete!") ”)
Echo. & Pause (Screen shows "Press any key to continue ...") Note: The function of ECHO is to make the screen display a blank line
------------------------------------------------------------
@echo off
@ Color 1a displays background and foreground text colors (see below for details)
Echo is cleaning up the system garbage file, please wait a moment ... does not work, text display
del/f/s/q%systemdrive%\\*.tmp Delete all temporary files in the system directory, usually useless, the installation software legacy.
del/f/s/q%systemdrive%\\*._mp and above the same
del/f/s/q%systemdrive%\\*.log Delete log files, generally useless
del/f/s/q%systemdrive%\\*.gid
del/f/s/q%systemdrive%\\*.chk Delete Windows scan files, typically chkdisk legacy files
del/f/s/q%systemdrive%\\*.old Delete extra temporary backup files
del/f/s/q%systemdrive%\\recycled\\*.* Empty Recycle Bin
del/f/s/q%windir%\\*.bak Delete Windows Backup files
del/f/s/q%windir%\\prefetch\\*.*
RD/S/q%windir%\\temp & MD%windir%\\temp
del/f/q%userprofile%\\cookies\\*.* Delete cookies that are left on the internet are usually set by Windows to speed up the speed of the Web page.
del/f/q%userprofile%\\recent\\*.* Delete history
del/f/s/q \ "%userprofile%\\local settings\\temporary Internet files\\*.*\" Delete ie temporary files del/f/s/q
del/f/s/q \ "%userprofile%\\local settings\\temp\\*.*\" Delete software temp files
del/f/s/q \ "%userprofile%\\recent\\*.*\"
Echo. & Pause

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.