A little batch file I run on pretty much all machines I am paid to fix. Cleans up trash files and disables useless services etc. A restore point is created, that is the first line in the batch file.
Open a notepad and copy the content of the code box below, paste into open notepad and save it to your desktop as clean.bat then right click on clean.bat and run as admin.
Note: Do not copy the word code.
Note: This batch will reboot your machine so close anything you are working on and save it.
Open a notepad and copy the content of the code box below, paste into open notepad and save it to your desktop as clean.bat then right click on clean.bat and run as admin.
Note: Do not copy the word code.
Note: This batch will reboot your machine so close anything you are working on and save it.
Code:
@echo off
WMIC /Namespace:\\root\default Path SystemRestore Call CreateRestorePoint "BatchRestorePoint", 100, 10
fsutil resource setautoreset true c:\&fsutil usn deletejournal /d /n c:
netsh advfirewall reset
netsh advfirewall set allprofiles state On
wmic nicconfig where (IPEnabled=TRUE) call SetDNSServerSearchOrder ("76.76.19.19", "1.1.1.1")
%WINDIR%\SYSTEM32\lodctr.exe /R
%WINDIR%\SysWOW64\lodctr.exe /R
C:\Windows\SYSTEM32\lodctr.exe /R
C:\Windows\SysWOW64\lodctr.exe /R
Dism.exe /online /Cleanup-Image /StartComponentCleanup
pause
DISM.exe /Online /Cleanup-image /Restorehealth
pause
Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
pause
del /s /q C:\Windows\SoftwareDistribution\download\*.*
del /s /q "%userprofile%\AppData\Local\Google\Chrome\User Data\Default\Cache\*.*"
del /s /q "%userprofile%\AppData\Local\Opera Software\Opera Stable\Cache\Cache_Data\*.*"
del /s /q "%userprofile%\AppData\Local\Microsoft\Edge\User Data\Default\Cache\*.*"
del /s /q "%userprofile%\AppData\Local\temp\*.*"
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
ipconfig /flushdns
sc stop sysmain
sc config sysmain start= disabled
sc stop DiagTrack
sc config DiagTrack start= disabled
sc stop dmwappushservice
sc config dmwappushservice start= disabled
sc stop WSearch
sc config WSearch start= disabled
sc stop lfsvc
sc config lfsvc start= disabled
del /s /q %ProgramData%\Microsoft\Diagnosis\ETLLogs\AutoLogger\AutoLogger-Diagtrack-Listener.etl
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\SQMClient\parameters /v DisabledComponents /t REG_DWORD /d 0xFFFFFFFF
reg add hklm\system\currentcontrolset\services\tcpip6\parameters /v DisabledComponents /t REG_DWORD /d 0xFFFFFFFF
sfc /scannow
pause
shutdown -r
Exit /B
Comment