Thursday, March 27, 2008

Finding the Temp Directory and Getting Temporary Filenames in VB.NET and C#

In a previous post, I showed how to get special directories like My Document and System32, but I also need to get the location of the Windows Temp directory and this is not covered by the SpecialFolders property (see previous post for more info on it).

Getting the Temp folder is just as simple, but it is done with a different property:

tempPath = System.IO.Path.GetTempPath

You can also generate temp filenames with:
tempFilename = System.IO.Path.GetTempFileName

4 comments:

Anonymous said...

awsome thx

Anonymous said...

Really Helpul! Thanx

Anonymous said...

Very helpful

Anonymous said...

If only the documentation made it this easy to find basic nuggets of usefulness like this. Many thanks.