Fix: Error writing a temporary file, Make sure your temp folder is valid
Error writing a temporary file, Make sure your temp folder is valid indicates that there is a problem with the folder Windows uses to store temporary files. This error can result from several reasons, such as the temporary folder being set in a different location, being deleted, or the user account in Windows lacking permissions.
There are several fixes mentioned below. Let’s dive into the solutions and fix this error.
1. Run the installer as an admin.
If the installer does not have administrator permissions, it will not be able to access the temporary files folder, resulting in the following error. To fix this issue, it is recommended to run the installer as an administrator. Follow these steps:
- Right-click on the installer file.
- Now, left-click on “Run as Administrator.
- A dialogue box will appear with Yes and No options; click Yes.
If you are on a user account, please refer to the administrator of your computer to help you resolve this issue.
2. Clean temporary files.
If there is no space left on the disk where the temporary files folder is located, you will encounter the following error. In this case, it is recommended to clean up your temporary files folder to make space for new temporary files. Follow these steps to clear your temporary files folder:
- Press the Windows key + R to launch the Run dialog.
- Type %temp% and hit Enter.
- Click Ctrl + A to select all items.
- Then, click Delete or press Ctrl+Delete to delete all files at once.
It’s okay if some files are unable to be deleted; it happens when those temporary files are being used by a process. They will be deleted eventually when the program is done using them.
3. Restart the Windows Installer service.
The Installer service assists with the installation and removal of software in Windows. This service may occasionally experience problems or stop functioning, which can interfere with the installation or removal of programs. Setting the parameters of this service back to default may fix it, enabling you to install the desired program.
- Open the Run dialog by pressing Win + R on the keyboard.
- Type “services.msc” in the dialog box.
- In the services tab, Scroll down and find “Windows Installer”
- Right-Click on Windows Installer and select the “Restart” button from the context menu.
Check to see whether the error is fixed.
4. Change the path of the Temp folder.
Some locations in Windows have very restricted access; only certain services and programs that Windows allows can access these locations, while an average user account cannot. In this case, we will define a new temporary files location for all the temporary files, allowing Windows to direct the program installer to this new location, which is much less restrictive than the normal temporary files location. Please follow these steps:
- Locate the C Drive.
- Now, Right-Click and create a folder.
- Press Win + I to launch the Settings tab and Navigate to System.
- Then, go to ‘About‘.
- Click on Advanced System Settings, which is under the device’s specifications.
- Then, click on Environmental Variables.
- Double-click on the TMP variable.
- The existing location or variable value would be
%USERPROFILE%\AppData\Local\Temp
- Change this variable to the location where you created the folder; in this case, that would be:
C:\Temp
Click on “OK.
- Now, close all the windows and restart your computer.
Check to see if the issue persists.
5. Disable Windows Defender.
Windows Defender can sometimes block the installer from accessing the temporary files folder. This is done in order to protect your computer and prevent unnecessary access to vulnerable files in Windows. However, if you trust the installer of the program, you can temporarily disable Windows Defender to allow the installer to install the program. Follow these steps:
- IIn the Windows Search bar, enter “Windows Security.
- Click on Virus & Threat Protection from the sidebar menu.
- Now, select “Manage Settings” under this section.
- Then, go to Toggle Off Real-time Protection.
- Restart your computer.
Now, check your installer by running it in administrative mode. Your error will be gone, and you can install any file you want while running it on your computer.