Lets Automate It

from Josh Rickard

Scripting Clean Java Temporary Install Files From User Profiles Win 7 Xp

2018-08-07 Josh Rickard

So I had an issue awhile back that need to be rectified and the fix was to clean out temporary install files from the Sun/Java folder in User profiles. This had to be done on about 700 machines, so I created this little script that cleans out these files and pushed it out to via AD. I hope you enjoy…..

Win 7 - Clean Java Temp Files CD C:\ CLS ECHO REM *** This DELETES temporary install files from the REM *** SUN/JAVA folder in User Profiles. REM *** Run this if you get a Pop-Up warning about your REM *** User Profile being too large. REM *** Click the corner [X ] to exit without running. REM *** Otherwise press the [Spacebar ] to continue. PAUSE DEL "%USERPROFILE%\AppData\LocalLow\Sun\Java\*.*" /S /F /Q RD "%USERPROFILE%\AppData\LocalLow\Sun\Java\" /S /Q DEL "%USERPROFILE%\AppData\Local\Temp\*.*" /S /F /Q RD "%USERPROFILE%\AppData\Local\Temp\" /S /Q CLS REM *** Folders are cleaned! PAUSE EXIT
Win XP - Clean Java Temp Files CD C:\ CLS ECHO REM *** This script is for Windows XP only it will NOT work on Vista or 7 REM *** This DELETES temporary install files from the REM *** SUN\JAVA and Local Settings\Temp folders in User Profiles. REM *** Run this if you get a Pop-Up warning about your REM *** User Profile being too large. REM *** Click the corner [X ] to exit without running. REM *** Otherwise press the [Spacebar ] to continue. PAUSE DEL "%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\Application Data\Sun\Java\*.*" /S /F /Q RD "%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\Application Data\Sun\Java\" /S /Q DEL "%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\Local Settings\Temp\*.*" /S /F /Q RMDIR "%SYSTEMDRIVE%\Documents and Settings\%USERNAME%\Local Settings\Temp\" /S /Q CLS REM *** Folders are cleaned! PAUSE EXIT