473,320 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Saving to the system TEMP directory

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?
Jul 21 '05 #1
5 2613
Hi Patrick,

Use the System.IO.Path.GetTempPath method.

HTH,
Rakesh Rajan

"Patrick" wrote:
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?

Jul 21 '05 #2
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
"Patrick" wrote:
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?

Jul 21 '05 #3
Hi Patrick!

"Patrick" schrieb
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
Jul 21 '05 #4
Thanks for the FAST response - this really helps - woo-hoo!
"Rakesh Rajan" <Ra*********@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
Hi Patrick,

Use the System.IO.Path.GetTempPath method.

HTH,
Rakesh Rajan

"Patrick" wrote:
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?

Jul 21 '05 #5
Anytime pal! :D

- Rakesh Rajan

"Patrick" <pa*****@hello.com> wrote in message
news:#7**************@TK2MSFTNGP10.phx.gbl...
Thanks for the FAST response - this really helps - woo-hoo!
"Rakesh Rajan" <Ra*********@discussions.microsoft.com> wrote in message
news:7F**********************************@microsof t.com...
Hi Patrick,

Use the System.IO.Path.GetTempPath method.

HTH,
Rakesh Rajan

"Patrick" wrote:
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?


Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jason Charalambides | last post by:
Hi, I wanted to do the following: 1. Save a file as "Tensegrity.tmp" in my C:\Temp directory (and if one exists to replace it without any interaction, asking me about it etc.) 2. Once this is...
3
by: Adam Parkin | last post by:
I was wondering, what's the "proper" (hehe) way to retrieve the system's temp directory in VB 6. Like for example, on my Windows XP machine the temp directory that is used by programs for their...
0
by: Matthew Fitzpatrick | last post by:
My application has a settings class that is serialized to save and deserialized to load. I'm having a problem where i catch the WM_QUERYENDSESSION event via WinProc to save my application's...
5
by: Patrick | last post by:
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...
0
by: Andrés G. Aragoneses | last post by:
When trying to use a webservices, not very often I obtain the following exception: Server was unable to process request. ---> Access to the temp directory is denied. Identity 'NT...
6
by: Najd | last post by:
Hi All, I'm developping a DLL that requiers the path of the Temp directory of the user logged. I used GetTempPath(), GetEnvironmentVariable() and ExpandEnvironmentStrings(), but the 3 methodes...
0
by: oritc123 | last post by:
Hello . I am having the following error when I run my application under Windows Vista ( it runs fine under Windows XP ) : "Access to the temp directory is denied. Identity 'ORITSLAPTOP\orit'...
6
by: Aussie Rules | last post by:
Hi, In my application I need to write an XML file to disk, but am concerned that permission might be a problem. The file only needs to be written out and used for another reason and can then...
1
by: Praveen St | last post by:
Hi, I need a perl script on windows which deletes the newline characters from a file and merges all the lines into one line and then write into another file in windows system %temp%...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.