Identifying a folder for temporary files -- %TEMP% or something else?

R

robert.dodier

Hello,

I am looking for a method to identify a folder where temporary
files can be written and later erased. Ideally this method will
work for Win98, Win2k, and WinXP, but if it only works for
Win2k and WinXP that is OK. If it only works for WinXP that
is problematic.

My WinXP box has environment variables %TMP% and %TEMP%,
and these name a folder Temp under "Local Settings" in my user
folder. That's great, but can I assume that %TMP% or %TEMP%
will be set up accordingly on all WinXP installations?
What at Win2k and Win98?

%TEMP% and/or %TMP% will work fine if I can count on those
variables existing and naming a valid, writeable folder.

Thanks for any comments.

Robert Dodier
 
T

Tom Porterfield

Hello,

I am looking for a method to identify a folder where temporary
files can be written and later erased. Ideally this method will
work for Win98, Win2k, and WinXP, but if it only works for
Win2k and WinXP that is OK. If it only works for WinXP that
is problematic.

My WinXP box has environment variables %TMP% and %TEMP%,
and these name a folder Temp under "Local Settings" in my user
folder. That's great, but can I assume that %TMP% or %TEMP%
will be set up accordingly on all WinXP installations?
What at Win2k and Win98?

%TEMP% and/or %TMP% will work fine if I can count on those
variables existing and naming a valid, writeable folder.

Thanks for any comments.

Those environment variables have existed by default in every version of
Windows since 95. Environment variables can be renamed or deleted, so
you should still check to make sure it has a valid value before using it.
--
Tom Porterfield
MS-MVP Windows
http://support.telop.org

Please post all follow-ups to the newsgroup only.
 

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