0

I want to create a batch file to change the location of the TEMP and TMP files for the current user to another drive. (And back again, but if I can do the one the reverse will be easy.) However, while the command appears to take effect in the command prompt, it does not in the file explorer.

I don't want to do this manually from the environment variable window in settings, since I want a one-click batch file solution. So I run the following from a command prompt, with Administrator permission:

c:\>set TMP=D:\temp

c:\>set TEMP=%TMP%

Then I check it as follows, and apparently it has worked:

c:\>d:

D:\>cd %tmp%

D:\temp>

However, when I open a file explorer window, and enter %TMP% in the file address, the folder goes to the usual location: C:\Users<localuser>\AppData\Local\Temp

This happens even if I start the folder window at the D: drive root. The command prompt and file explorer appear to have a different setting for %TMP%. I assume the file explorer is correct and the one windows will use, so my command prompt commands have not worked.

Am I missing something?

dodrg
  • 1,284
  • 1
  • 11
  • 1
    also https://superuser.com/questions/916649/what-is-the-difference-between-setx-and-set-in-environment-variables-in-windows/916652#916652 – Frank Thomas May 17 '23 at 01:30

0 Answers0