Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 10th, 2004, 02:33 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default Console application temp directory

In a windows forms application you can use this to get the path to a a user's "application data" temp directory:

Application.UserAppDataPath

How does one do this in a console application? I've been scouring the MSDN documentation and I can't seem to find anything similar. There certainly isn't anything under the console namespace, and there doesn't seem to be any access to the Application namespace from a console app.

Peter
-------------------------
Work smarter, not harder
__________________
-Peter
compiledthoughts.com
twitter/peterlanoie
 
Old April 10th, 2004, 05:54 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hmmm, I don't know how to do this directly, but can't you cheat a little by adding a reference to System.Windows.Forms and then import the namespace? That allows you to use Application.UserAppDataPath like you normally would....

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Innocence by The Smashing Pumpkins (Track 7 from the album: Machina II: Friends and Enemies of Modern Music)

 
Old April 10th, 2004, 06:02 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I suppose I could I'll try that if the need arrises again.
Even though I didn't end up using this, I found what really wanted:

Path.GetTempPath()
Path.GetTempFileName()





Similar Threads
Thread Thread Starter Forum Replies Last Post
Console application but no Console gamotter C# 2 August 22nd, 2007 11:41 PM
Avoid Exporting Temp Directory W/ .htm File chuckca Crystal Reports 0 July 22nd, 2005 07:21 PM
Console Application digby_dog VB.NET 2002/2003 Basics 2 April 29th, 2005 10:52 AM
Console application and web application nsrujan ASP.NET 1.0 and 1.1 Basics 1 April 16th, 2005 10:35 PM
SendMail from a Console Application r_ganesh76 General .NET 3 March 1st, 2005 11:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.