cleaner

Hi

I’ve made some research cleaning Old windows vmware disks enjoying “old style of 90’s”

Here are a nice script , it  cleans Explorer cache & makes automatic cleanup

< Begin Code >


cleanmgr /sagerun:11
@echo off

Set “RegKey=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList”
set “regkey2=HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\shell folders”

call:getspecialfolders “Cache, History, Cookies”

For /f “tokens=*” %%? in (
‘Reg.exe QUERY “%RegKey%” ^|findstr /ric:”\S-1-5-21-[0-9]*-[0-9]*-[0-9]*-[0-9]*$”‘
) do (
For /f “tokens=2,*” %%A in (
‘Reg.exe QUERY “%%?” /v ProfileImagePath ^|find /i “ProfileImagePath”‘
) do call:Go %%B
)

start “”/w “%windir%\system32\RunDll32.exe” InetCpl.cpl,ClearMyTracksByProcess 255

:end ***
goto:EOF
:Go
call Set “Target=%*”
If EXIST “%Target%” call:Clear “%Target%”
exit /b 0

:Clear
rem echo.&echo.%~1\%$$Cache%\Content.IE5
pushD “%~1\%$$Cache%\Content.IE5” &&(
rmdir /s /q .
popD)2>nul

rem echo.&echo.%~1\%$$History%\History.IE5
pushD “%~1\%$$History%\History.IE5” &&(
rmdir /s /q .
popD)2>nul

rem echo.&echo.%~1\%$$History%
pushD “%~1\%$$History%” &&(
rmdir /s /q .
popD)2>nul

rem echo.&echo.%~1\%$$Cookies%
pushD “%~1\%$$Cookies%” &&(
rmdir /s /q .
popD)2>nul

rem echo.&echo.%~1\%$$Cache%
pushD “%~1\%$$Cache%” &&(
rmdir /s /q .
popD)2>nul

rem echo.&echo.%~1\%$$temp%
pushD “%~1\%$$temp%” &&(
rmdir /s /q .
popD)2>nul
exit /b 0

:getspecialfolders
Set “FoldersToClear=%~1”

For %%* in (%FoldersToClear%) Do (
For /f “tokens=2,*” %%A in (
‘reg.exe query “%regkey2%” /v %%* ^|find /i “%%~*”‘
) do Call:sf1 “%%~B” “%%~*”
)
Call:sf2 “%temp%” “temp” “%userprofile%”
exit /b 0

:sf1
Call set “sf=%~1”
Call set “$$%~2=%%sf:%userprofile%\=%%”
exit /b 0

:sf2
Call set “sf=%~1”
call Set “usr=%~dpns3”
Call set “$$%~2=%%sf:%usr%\=%%”
exit /b 0


<end code >