Why does the name of my TEMP directory keep changing?

Raymond Chen

A customer liaison contacted the shell team with the following request:

Subject: Support case: 069314718055994

On two of my customer’s machines, he’s finding that if he opens %TEMP% from the Start menu, it opens C:\Users\username\AppData\Local\Temp\1, C:\Users\username\AppData\Local\Temp\2, and so on. Each time the user logs off and back on, the number increments. The number resets after each reboot. Why are we seeing these folders being created under Temp? This does not appear to be the default behavior. What would cause the operating system to create these folders?

The customer rebuilt one of the affected machines, and the behavior went away. However, the customer claims that both machines were working fine before, and then this problem suddenly started. Therefore, the customer is afraid that the problem will come back in the future. Any pointers in solving this mystery would be very much appreciated.

It’s not clear why this question was directed at the shell team, since Explorer doesn’t set your TEMP directory. (In general, a lot of random questions come to the shell team not because they are shell questions but because people don’t know where else to turn. Since the shell presents the desktop, and the desktop is on the screen when the problem occurs, maybe it’s a shell issue!) The question was redirected to the Remote Desktop team, since it is Remote Desktop that creates these subdirectories off the TEMP directory. And from there, psychic powers predicted that 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. (Yet another of those crazy negative checkboxes.) There is also a knowledge base article describing the registry keys behind these group policies.

The customer liaison responded cryptically,

Thanks. I tested the policies and it is the one that creates the folder.

Not sure what this means for solving the customer’s problem, but that was the last we heard from the customer liaison, so I guess this policy was enough to give the customer a nudge in the right direction.

0 comments

Discussion is closed.

Feedback usabilla icon