473,403 Members | 2,071 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,403 software developers and data experts.

Find the temporary folder

I just wonder if it's a simpler way to get the path to the current user's
temporary folder than this:

string path = Path.GetFullPath(Path.Combine(Environment.GetFolde rPath(
Environment.SpecialFolder.LocalApplicationData), "..\\Temp"));

It works, but is quite cumbersome. I also find it strange that
Path.Combine()
doesn't fix the '..\' part, so I need to use Path.GetFullPath() to have the
'..\' resolved (it walks down one directory from the '..\Local Settings\
Application Data' folder and gives '..\Local Settings').

--
Asbjørn Ulsberg -=|=- as******@hotmail.com
"He's a loathsome offensive brute, yet I can't look away"
Nov 16 '05 #1
4 19803
"Asbjørn Ulsberg" <as******@hotmail.com> wrote in
news:op**************@news.individual.net...
I just wonder if it's a simpler way to get the path to the current user's
temporary folder than this:

string path = Path.GetFullPath(Path.Combine(Environment.GetFolde rPath(
Environment.SpecialFolder.LocalApplicationData), "..\\Temp"));

It works, but is quite cumbersome. I also find it strange that
Path.Combine()
doesn't fix the '..\' part, so I need to use Path.GetFullPath() to have the '..\' resolved (it walks down one directory from the '..\Local Settings\
Application Data' folder and gives '..\Local Settings').

--
Asbjørn Ulsberg -=|=- as******@hotmail.com
"He's a loathsome offensive brute, yet I can't look away"


Usually %temp% points to the temp folder, so you could try
'Environment.GetEnvironmentVariable("temp")'.

Niki
Nov 16 '05 #2
"Asbjørn Ulsberg" <as******@hotmail.com> wrote in message
news:op**************@news.individual.net...
I just wonder if it's a simpler way to get the path to the current user's
temporary folder than this:

string path = Path.GetFullPath(Path.Combine(Environment.GetFolde rPath(
Environment.SpecialFolder.LocalApplicationData), "..\\Temp"));

It works, but is quite cumbersome. I also find it strange that
Path.Combine()
doesn't fix the '..\' part, so I need to use Path.GetFullPath() to have the '..\' resolved (it walks down one directory from the '..\Local Settings\
Application Data' folder and gives '..\Local Settings').

--
Asbjørn Ulsberg -=|=- as******@hotmail.com
"He's a loathsome offensive brute, yet I can't look away"


System.IO.Path.GetTempPath();
Arild
Nov 16 '05 #3
"Asbjørn Ulsberg" <as******@hotmail.com> wrote in message
news:op**************@news.individual.net...
I just wonder if it's a simpler way to get the path to the current user's
temporary folder than this:

string path = Path.GetFullPath(Path.Combine(Environment.GetFolde rPath(
Environment.SpecialFolder.LocalApplicationData), "..\\Temp"));


How about

string path = System.Environment.GetEnvironmentVariable("TEMP");
Nov 16 '05 #4
Hi,
I just wonder if it's a simpler way to get the path to the current user's
temporary folder than this:

string path = Path.GetFullPath(Path.Combine(Environment.GetFolde rPath(
Environment.SpecialFolder.LocalApplicationData), "..\\Temp"));

It works, but is quite cumbersome. I also find it strange that
Path.Combine()
doesn't fix the '..\' part, so I need to use Path.GetFullPath() to have the
'..\' resolved (it walks down one directory from the '..\Local Settings\
Application Data' folder and gives '..\Local Settings').


Use:

Path.GetTempPath()

Other way is to get path from environmental variable by:

Environment.GetEnvironmentVariable("TEMP")
or
Environment.GetEnvironmentVariable("TMP")

Regards

Marcin
Nov 16 '05 #5

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

Similar topics

6
by: Asbjørn Ulsberg | last post by:
I just wonder if it's a simpler way to get the path to the current user's temporary folder than this: string path = Path.GetFullPath(Path.Combine(Environment.GetFolderPath(...
2
by: Juleke | last post by:
Hello, For some test, I have setup one computer with Win 2003 Standard + IIS + Active Directory My problem is Access to the path "c:\windows\microsoft.NET\framework\v1.1.4322\temporary ASP.NET...
0
by: Cristian | last post by:
Hi guys, does ASP.NET use a temporary folder when a file is uploaded, if so which folder it it and is it possible to change it? thanks /C.
1
by: Mathieu Cartoixa | last post by:
Hi all, We have developed a web application in ASP .NET (C#, .NET 2.0, IIS 6.0, Windows Server 2003), with integrated Windows authentification, and impersonation. I have tried to use memory...
1
by: raghulvarma | last post by:
I need to find a folder for example if folder name is aaa then I need to find the drive in which it is stored.Which means I do not know in which position the folder aaa is present,once I give the...
2
by: bala | last post by:
hi i like to know how to get the internet temporary folder path in javascript ... thanks in advance
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.