Fix Access Denied Errors in Windows Temp Folder
In this article
Yes, you can fix Access Denied errors in the Windows Temp folder by correcting the folder’s permissions or resetting its security settings.
What You'll Need
- Administrator account on the PC
- File Explorer
- Command Prompt (run as administrator)
- Basic knowledge of folder properties and security tabs
Step-by-Step
-
Close all programs that might be using the Temp folder. Applications such as installers, browsers, or development tools often lock files inside
%temp%. Closing them ensures the folder isn’t in use while you change permissions. -
Open the Temp folder in File Explorer. Press Win + R, type
%temp%and press Enter. This opens the user‑specific temporary folder (usuallyC:\Users\YourName\AppData\Local\Temp). For the system Temp folder, navigate toC:\Windows\Temp. - View the folder’s properties. Right‑click the folder, select Properties, then click the Security tab. This tab shows which accounts have which permissions.
- Open the Advanced security settings. In the Security tab, click the Advanced button near the bottom. The Advanced window lets you change the owner and view inherited permissions.
-
Check the current owner. At the top of the Advanced window you’ll see “Owner:”. If the owner is not your user account or the built‑in
Administratorsgroup, click Change. - Change the owner to your account. In the "Select User or Group" dialog, type your user name, click Check Names to verify, then press OK. Back in the Advanced window, tick the box “Replace owner on subcontainers and objects” and click Apply. This propagates the new ownership to all subfolders and files.
- Add your account with Full Control. Still in the Advanced window, click Add → Select a principal. Type your user name, confirm with Check Names, then click OK. In the permissions pane, choose Full control under "Basic permissions" and make sure the "Allow" radio button is selected. Click OK to close each dialog.
- Confirm the changes. Back on the main Security tab, you should now see your user account listed with "Full control" and a checkmark under "Allow". Click OK to close the Properties window. Windows will now apply the new ACLs to every file inside the Temp folder.
-
Test the folder. Open a new Command Prompt (not elevated) and type
echo test > %temp%\test.txt. If the file is created without an error, the permission issue is resolved. -
If the error persists, reset the ACLs with icacls. Open Command Prompt as Administrator (right‑click the Start button, choose Windows Terminal (Admin) or Command Prompt (Admin)). Run the following command to reset permissions on the user Temp folder:
icacls "%temp%" /reset /T /C /L
The switches mean:/resetrestores default inherited permissions,/Tprocesses all subfolders,/Ccontinues on errors, and/Lworks on symbolic links as links. -
Reset the system Temp folder as well. Still in the elevated Command Prompt, execute:
icacls "C:\Windows\Temp" /reset /T /C /L
This ensures the system‑wide Temp folder also has the correct default ACLs. - Restart the computer. A reboot forces Windows to re‑apply the updated security descriptors. After the restart, try creating a temporary file again (repeat step 9) to confirm the issue is gone.
Common Mistakes
Many users forget to run the Command Prompt with administrator privileges, causing the icacls commands to fail silently. Another frequent error is changing permissions on the wrong folder – the user Temp folder (%temp%) is different from the system Temp folder (C:\Windows\Temp). Removing the SYSTEM or TrustedInstaller entries can break Windows updates, so always keep those entries with at least read access.
Tips
- Use the built‑in Administrator account if your regular account is heavily restricted; you can enable it via
net user administrator /active:yesin an elevated prompt. - Before making changes, you can export the current ACLs with
icacls "%temp%" /save C:\temp_acls.txt /T. This gives you a backup you can restore later. - If an antivirus program is locking files, temporarily disable real‑time scanning while you adjust permissions.
- Running
chkdsk /fon the drive that hosts the Temp folder can fix underlying file‑system errors that sometimes manifest as Access Denied.
Troubleshooting
If the steps above do not resolve the problem, try the following sequence:
- Boot into Safe Mode (press F8 or use
msconfig) and repeat the permission reset. Safe Mode loads minimal drivers, preventing third‑party software from interfering. - Check the disk for errors with
chkdsk C: /f /r. Corrupt sectors can cause misleading permission errors. - Temporarily rename the existing Temp folder (e.g.,
Temp_old) and let Windows recreate a fresh one. After a reboot, Windows will generate a newTempdirectory with default ACLs. - Review Group Policy settings: run
gpedit.msc, navigate to Computer Configuration → Administrative Templates → System → Filesystem, and ensure no policies are explicitly denying write access to the Temp path. - If a third‑party cleanup tool (CCleaner, Disk Cleanup, etc.) is resetting permissions, disable it or adjust its settings to exclude the Temp folder.
Frequently Asked Questions
Why do Access Denied errors appear in the Temp folder?
Typical causes are corrupted ACLs, an incorrect owner, or interference from security software that blocks write access.
Can I delete the entire Temp folder?
Yes, you can delete its contents, but not the folder itself while Windows is running. Deleting the folder may cause Windows to recreate it with default permissions.
Will resetting permissions affect other programs?
Resetting restores the default inherited permissions, which are compatible with most applications. However, custom ACLs set by specific software may be lost, requiring a reinstall of that software.
Do I need to repeat these steps after a Windows update?
Usually not. Updates preserve standard ACLs, but if an update changes the folder’s owner, you may need to repeat the ownership step.
What if I still get “Access is denied” after all steps?
Check for disk encryption (BitLocker) or ransomware protection that may be blocking the folder, and verify that your account is still a member of the Administrators group.
Is there a way to automate the fix?
You can create a batch file that runs the two icacls commands with administrative rights, then schedule it to run after each reboot.