473,323 Members | 1,537 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,323 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 19783
"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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.