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
How to fix Windows Update errors?
Clearing temporary Windows Update files usually fixes most update errors. So, to fix Windows Update errors, use this nifty script!
How to fix Windows Update stopping or dropping updates before completing?
Most Windows Update errors can be resolved by deleting temporary Windows Update files. Use this script to help you do this!
How to fix “We couldn’t complete the updates. Undoing changes. Don’t turn off your computer.” in Windows Update?
Getting the “we couldn’t complete the updates” error notification is annoying. Lucky for you, there are some easy fixes.
For one thing, you could run the Windows Update Troubleshooter. Another thing you could do is to launch the Startup Repair tool.
What is the Software Distribution folder, and how do I delete it?
The Software Distribution folder is used to store temporary files, usually stemming from Windows Updates. If you want to get rid of this folder and these temporary files, this script can help you do just that!
How to delete temporary files?
Deleting temporary files is reeeeally easy to do with this dandy script!
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.
Explore our shared script library
The all-in-one IT management platform that will take your IT operations to the next level!