473,378 Members | 1,475 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,378 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 19789
"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
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...
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.