Difference between TEMP and TMP variables?

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.
 
D

David H. Lipman

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.
 
G

Guest

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.
 
G

Guest

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.
 
D

David Candy

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).
 
A

Alex Nichol

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
 
D

David Candy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top