23

I want to point a file dialog at a particular folder in the current user's Local Settings folder on Windows. What is the shortcut to get this path?

4

3 回答 3

35

How about this, for example:

String appData = 
    Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

I don't see an enum for just the Local Settings folder.

http://web.archive.org/web/20080303235606/http://dotnetjunkies.com/WebLog/nenoloje/archive/2007/07/07/259223.aspx has a list with examples.

于 2008-09-11T19:08:43.373 回答
2
string localPath = Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)).FullName;

is the simple answer.

于 2011-08-07T06:50:36.777 回答
1

Environment.GetFolderPath( Environment.SpecialFolders.LocalApplicationData);?

I can't remember if there is a "Local Settings" folder on Windows XP anymore, it seems vaguely familiar.

于 2008-09-11T19:08:15.577 回答