Saving to the system TEMP directory

  • Thread starter Thread starter Patrick
  • Start date Start date
P

Patrick

Hello - I am working on a program that creates a small temp file. The ideal
would be it creates the file in the user %temp% directory - whatever that
is - the default is %USERPROFILE%\Local Settings\Temp.

Is there an easy way to set a variable to the users %TEMP% directory in
Visual Basic .NET?
 
You can use Path.GetTempPath() to get the path to the current system's
temporary folder.

You can also use Path.GetTempFileName() to obtain a unique filename to use.

Alex Korchemniy
 
Hi Patrick!

Hello - I am working on a program that creates a small temp file. The
ideal
would be it creates the file in the user %temp% directory - whatever that
is - the default is %USERPROFILE%\Local Settings\Temp.

Is there an easy way to set a variable to the users %TEMP% directory in
Visual Basic .NET?

Use Environment.GetEnvironmentVariable("TEMP")

Cheers

Arne Janning
 
Back
Top