473,387 Members | 1,493 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,387 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 19797
"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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...

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.