Saturday 6 November 2010

Changing the Windows TEMP Directory

I have been hitting the Windows path length limit of 260 characters on my local workspace, but it is not the workspace root that is causing the problem. Instead, the error message indicates that the temporary file could not be created.


As noted in KB article #978, you can avoid most path length issues by moving the local workspace root to a shorter path. However this does not affect the current location of the Windows TEMP directory, typically located on the path: C:\Users and Documents\{user name}\local settings\tempBefore adding the user name this is a 43 character path. Adding a user name of 8 letters pushes this over 50 characters. The location of the temporary file directory is controlled by the operating system, as noted in the Perforce Command Reference. To set the Windows temporary directory location for a current DOS command prompt, you can to use the "set" command from the command prompt. For example: set TMP=C:\temp set TEMP=%TMP% Note: The temporary directory must already exist. The first command sets the value for %TMP%. The second verifies that the %TEMP% value is the same as %TMP% -- a mismatch of those two values can cause a variety of problems for anything that uses the temporary directory. To permanently set the temporary directory for a Windows user account, go to Control Panel->System->Advanced, and enter the "Environment Variables" dialog window to find and change the TEMP and TMP variable settings in the "User variables".

View the original article here

No comments:

Post a Comment