Have you recently (or not that recently) updated new versions of Windows? Great, now’s the time to clear some space by deleting the temporary files and user profiles you no longer need. Why do this, you ask? Well, clearing temporary Windows Update files usually fixes most update errors.
These temporary files are used by the Windows Setup process when installing a major update — and unless you’re in the middle of a Windows installation, you don’t need them anywhere and are welcome to get rid of them once and for all!
This script deletes temporary files for Windows Update, all user profiles, as well as the system TEMP directory. The script will momentarily stop the Windows Update service until its temporary files have been deleted; and start the service again once completed.
It’s worth noting that clearing temporary Windows Update files usually fixes most update errors.
The Script:
Atera does not guarantee the integrity, availability, security, virus-free, safety, lawfulness, non-infringement, rights’ status, or functionality of the scripts. The use of the shared scripts is at your own risk. Scripts are provided “AS IS”. *
cd /D C:\Users
for /D %%a in (*.*) do DEL /F /S /Q "%%a\AppData\Local\Temp\*.*"
for /D %%a in (*.*) do FOR /D %%b IN ("%%a\AppData\Local\Temp\*.*") DO RMDIR /S /Q "%%b"
DEL /F /S /Q %windir%\TEMP
net stop wuauserv
DEL /F /S /Q %windir%\SoftwareDistribution
net start wuauserv
Technical Notes:
1. Some Windows Update errors may not be resolved by deleting the Software Distribution contents alone. It may be necessary to also delete catroot files or apply other fixes, such as running DISM or SFC.
2. We recommend running this script as an administrator or higher. Otherwise, it may not run successfully.
3. This script may experience long run times due to the wildcard recursive file search method used, a slow filesystem I/O, or long response wait times.