Difference between TEMP and TMP variables?

  • Thread starter Thread starter overbored
  • Start date Start date
O

overbored

What's the difference between the environment variables TEMP and TMP? The
prerequisite Google search turned up nothing. I don't think they're
guaranteed to be the same. Is either one of them bad practice/obsolete?
Thanks in advance.
 
99% of the time they point to the same location. They are legacy environmental variables
form DOS days when they may have pointed to different locations because they were needed for
different applications.

Dave




| What's the difference between the environment variables TEMP and TMP? The
| prerequisite Google search turned up nothing. I don't think they're
| guaranteed to be the same. Is either one of them bad practice/obsolete?
| Thanks in advance.
 
You'll find them in system properties,users.To see what is stored in it,go
to run,type:%Temp% Then in new window,edit,select all,delete all,close
out,empty recycle-bin.Thier all temporary installation files,none are used
anymore but to take up space.
 
o- [Mon, 11 Oct 2004 14:39:24 -0700]:
What's the difference between the environment variables TEMP and TMP? The

TMP -> developer tools temporary files
TEMP -> user apps temporary files

Usually, way back when, dev tools needed lots of temp
space while user apps not much. Today, it's probably
reversed, and yeah, these may as well point to the same
place. What's that got to do with having two? I'm
sure TMP came first, but that was too 'oddly' spelt for
regular users, so out came TEMP, many years after TMP.
TMP had to stay around. TMP is nice because TMP\0 fits
in an even number of bytes: a nice-sized, 4-byte chunk.
 
Temp is the Dos variable and Tmp is the Windows variable. Windows uses Tmp or if not set will look for Temp and use that.

But as most programmers don't have a clue about the difference either, programs often use Temp (they should be using neither as programs are supposed to ask windows where to write their temp files to and windows replies with the temporary directory to use).
 
overbored said:
What's the difference between the environment variables TEMP and TMP? The
prerequisite Google search turned up nothing. I don't think they're
guaranteed to be the same. Is either one of them bad practice/obsolete?

TEMP is the usual one, but there are still some ancient programs around
that use TMP, so it is usual to set both (to the same folder) just in
case. They then behave identically
 
Remarks
Windows 95/98/Me: The GetTempPath function gets the temporary file path as follows:

1.. The path specified by the TMP environment variable.
2.. The path specified by the TEMP environment variable, if TMP is not defined or if TMP specifies a directory that does not exist.
3.. The current directory, if both TMP and TEMP are not defined or specify nonexistent directories.
Windows NT/2000/XP: The GetTempPath function does not verify that the directory specified by the TMP or TEMP environment variables exists. The function gets the temporary file path as follows:

1.. The path specified by the TMP environment variable.
2.. The path specified by the TEMP environment variable, if TMP is not defined.
3.. The Windows directory, if both TMP and TEMP are not defined.
 
Back
Top