Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does %TEMP% resolve to a non-deterministic path of the form %TEMP\<digit>?

I have a Windows Server 2008 32 bit and when I'm typing %temp% it takes me to ..AppData\Local\Temp\1\ or ..AppData\Local\Temp\2 instead of ..AppData\Local\Temp

I've already checked the Environment Variables and they are ok.

I'm asking that because I have an application that's supposed to copy files to %temp%\my application and instead it copies the files to %temp%\1\my application

Does someone have a solution for that?

like image 880
shacharsa Avatar asked Jun 29 '11 13:06

shacharsa


People also ask

What is the difference between TEMP and TMP?

There is no difference. They are just different aliases for the same path. As Mark mentioned, some programs use %TMP% while other use %TEMP% .

How is the environment variable TEMP defined?

The TEMP/TMP environment variables specify the location in which most programs place temporary files. By default, TEMP/TMP location is in the Windows partition. To speed up the access, you may set the TEMP/TMP variables to a ram disk.

How do you change a temp variable?

Select the TEMP variable row and click the [Edit] button. The Edit User Variable dialog box will be displayed. Alternatively, the user can double-click the TEMP variable row to display this dialog box.


1 Answers

Explanation, discussion, workarounds, etc, all under the Old New Thing article Why does the name of my TEMP directory keep changing - it ensures multiple terminal services sessions for the same user don't (by default) share a temp directory.

The problem lay in the Administrative Templates\Windows Components\Terminal Services\Temporary folders group policy. If you don't select Do not use temporary folders per session, then these TEMP subdirectories are created. There is also a knowledge base article describing the registry keys behind these group policies.

Personally, I find the first comment in reply to be the most useful:

Why does it matter if the temp location jumps around anyway, it's temporary!

See also

  • Use separate temporary folders for each session
like image 90
Damien_The_Unbeliever Avatar answered Sep 28 '22 05:09

Damien_The_Unbeliever