Skip to content

Instantly share code, notes, and snippets.

@AndrewBarfield
Created April 29, 2012 17:13
Show Gist options
  • Save AndrewBarfield/2552013 to your computer and use it in GitHub Desktop.
Save AndrewBarfield/2552013 to your computer and use it in GitHub Desktop.
DOS Batch File: Windows 7 Cleanup Script
echo off
REM Replace [[[USER]]] with your local user account name
REM Clean Libraries
del /Q /S "C:\Users\[[[USER]]]\Contacts\*.*" > nul
del /Q /S "C:\Users\[[[USER]]]\Downloads\*.*" > nul
del /Q /S "C:\Users\[[[USER]]]\Music\*.*" > nul
del /Q /S "C:\Users\[[[USER]]]\Pictures\*.*" > nul
del /Q /S "C:\Users\[[[USER]]]\Videos\*.*" > nul
del /Q /S "C:\Users\Public\*.*" > nul
REM Clean Temp Folders
rmdir /Q /S "C:\Users\[[[USER]]]\AppData\Local\Temp" > nul
mkdir "C:\Users\[[[USER]]]\AppData\Local\Temp" > nul
rmdir /Q /S "C:\Users\[[[USER]]]\AppData\LocalLow\Temp" > nul
mkdir "C:\Users\[[[USER]]]\AppData\LocalLow\Temp" > nul
rmdir /Q /S "C:\Users\All Users\Temp" > nul
mkdir "C:\Users\All Users\Temp" > nul
rmdir /Q /S "C:\Program Files (x86)\Temp" > nul
mkdir "C:\Program Files (x86)\Temp" > nul
REM Clean Special System Folders
rmdir /Q /S "C:\$RECYCLE.BIN" > nul
REM Disable Hibernate
powercfg.exe /hibernate off > nul
@CPPF0rev3r
Copy link

You can use %username% instead of [[[USER]]].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment