473,398 Members | 2,125 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,398 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 2618
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.