guide · static export
PC

Move the Temp Folder to Another Drive Safely

Temporary files fill the system drive and shorten the life of a small SSD. Moving them is one environment variable and one restart, with two caveats.

by@guidox updated:10/31/26 time:25 min level:Intermediate tested on:Windows 11 24H2 works on:Windows 10, Windows 11 tools:Second drive, Admin rights
TL;DR

Create a **Temp** folder on the target drive, set **TEMP** and **TMP** for the user, then for the system, and reboot. Some installers still write to the system drive and a network path breaks them.

Before you start

Requirements

  • A second drive
  • Admin rights
  • Twenty minutes
Step by step

Instructions

01

Create the destination first

Both variables must point at an existing folder. A missing folder makes installers fail with a permission error that names the installer, not the path.

mkdir D:\emp
02

Set the user variables

The user-level values cover most applications and need no elevation. Open the environment editor and change both TEMP and TMP, which Windows treats as separate names for the same idea.

SystemPropertiesAdvanced.exe > Environment Variables
03

Decide about the system variables

The system-level values cover services and installers that run as another account. Change them too if the point is to keep the system drive small; leave them if a store app complains.

setx /M TEMP D:\emp
tipA machine-level change needs a reboot before every service sees it. The user change applies to new processes immediately.
04

Clean the old folder, do not delete it

The old Temp folder still holds files in use by running processes. Clear what can be removed with the disk cleanup tool instead of deleting the folder itself.

cleanmgr
⚠ warningDeleting the folder outright breaks anything that expects it to exist, including some installers that hard-code the path.
05

Keep it on a local disk

A network share or a removable drive makes temporary files slow and can break a program mid-install. The target must be an internal drive that is always present.

06

Verify with a new process

Open a fresh terminal and print both variables. An old window keeps the values it started with, which is why a change that appears not to work is often a stale process.

echo %TEMP%
Troubleshooting

Common issues

An installer fails with access denied

The folder permissions or the path. Grant your account full control and check for a typo in the variable.

Temporary files still appear on C

That app uses its own path or the machine variable. Check both.

The drive is slower than the system SSD

Temporary files are latency-sensitive. A hard drive for Temp makes installs slower, not faster.

Something broke after the change

Set both variables back to the default paths and reboot. That restores the original behaviour.

FAQ

Frequently asked

How much space does this save?

Usually a few gigabytes, more after large installs and video exports.

Does it reduce SSD wear?

Marginally. Modern drives tolerate the write volume of a temp folder easily.

How to undo this

Set **TEMP** and **TMP** back to **%USERPROFILE%\AppData\Local\Temp** (user and machine) and reboot. The folder on the second drive can then be deleted.

Changelog · 1 entry
  1. 2026-10-31
    First version
Interactive version: checklist, feedback, related guides →

Free · no account needed · tracks your progress