473,769 Members | 6,926 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GetFullPat h(Path.Combine( Environment.Get FolderPath(
Environment.Spe cialFolder.Loca lApplicationDat a), "..\\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.GetFullPat h() to have the
'..\' resolved (it walks down one directory from the '..\Local Settings\
Application Data' folder and gives '..\Local Settings').

--
Asbjørn Ulsberg -=|=- as******@hotmai l.com
"He's a loathsome offensive brute, yet I can't look away"
Nov 16 '05 #1
4 19849
"Asbjørn Ulsberg" <as******@hotma il.com> wrote in
news:op******** ******@news.ind ividual.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.GetFullPat h(Path.Combine( Environment.Get FolderPath(
Environment.Spe cialFolder.Loca lApplicationDat a), "..\\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.GetFullPat h() to have the '..\' resolved (it walks down one directory from the '..\Local Settings\
Application Data' folder and gives '..\Local Settings').

--
Asbjørn Ulsberg -=|=- as******@hotmai l.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.Ge tEnvironmentVar iable("temp")'.

Niki
Nov 16 '05 #2
"Asbjørn Ulsberg" <as******@hotma il.com> wrote in message
news:op******** ******@news.ind ividual.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.GetFullPat h(Path.Combine( Environment.Get FolderPath(
Environment.Spe cialFolder.Loca lApplicationDat a), "..\\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.GetFullPat h() to have the '..\' resolved (it walks down one directory from the '..\Local Settings\
Application Data' folder and gives '..\Local Settings').

--
Asbjørn Ulsberg -=|=- as******@hotmai l.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******@hotma il.com> wrote in message
news:op******** ******@news.ind ividual.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.GetFullPat h(Path.Combine( Environment.Get FolderPath(
Environment.Spe cialFolder.Loca lApplicationDat a), "..\\Temp") );


How about

string path = System.Environm ent.GetEnvironm entVariable("TE MP");
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.GetFullPat h(Path.Combine( Environment.Get FolderPath(
Environment.Spe cialFolder.Loca lApplicationDat a), "..\\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.GetFullPat h() to have the
'..\' resolved (it walks down one directory from the '..\Local Settings\
Application Data' folder and gives '..\Local Settings').


Use:

Path.GetTempPat h()

Other way is to get path from environmental variable by:

Environment.Get EnvironmentVari able("TEMP")
or
Environment.Get EnvironmentVari able("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
4567
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( 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...
2
1376
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 Files\...." is denied when I'm trying to use a .NEt application
0
880
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
2995
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 streams, as opposed to temporary files, as often as possible beacuse we want to spare our client the pain of folder rights administration. But our efforts proved worthless as we integrated Crystal Reports (VS2005 edition) in our application : their...
1
1219
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 folder name it has to specify at which location is that folder aaa is present.Just like search in windows XP
2
7088
by: bala | last post by:
hi i like to know how to get the internet temporary folder path in javascript ... thanks in advance
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9865
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.