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?
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.
Personally, I find the first comment in reply to be the most useful:
See also
Environment variables have 4 contexts:
(do Win+R then type regedit to find the paths below)
HKLM\System\CurrentControlSet\Control\Session Manager\Environment
)HKCU\Environment
)HKCU\VolatileEnvironment
)ref: https://rakhesh.com/windows/temp-environment-variable-has-a-2-or-other-number-after-it/
When the Group Policy
Do not use temporary folders per session
isn't configured or isn't set to Enabled, the system will generate two Volatile Environment variablesTEMP
&TMP
with the same value of the current user'sTEMP
variable with the addition of an incremental number at the end of the TEMP folder (increments each time the user logs in, check @Damien's answer for details)If you set the group policy
Do not use temporary folders per session
to enabled, this behavior will not occur.