Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the current user's Local Settings folder path in C#?

Tags:

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?

like image 579
Luke Avatar asked Sep 11 '08 19:09

Luke


People also ask

How to get Local folder path in c#?

Show activity on this post. You can use Application. StartupPath. It Gets the path for the executable file that started the application, not including the executable name.

What is the Local Settings folder?

C:\Documents and Settings\[MyName]\Local Settings\Application Data holds data regarding configuration files, settings, and other data which may/may not be required.

Where is the Local Settings folder in Windows 10?

You may find that folder's contents in 'C:\Users\YourUserID\AppData\Local' folder in Windows 10.


2 Answers

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.

like image 195
Matthew Maravillas Avatar answered Oct 11 '22 17:10

Matthew Maravillas


string localPath = Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)).FullName; 

is the simple answer.

like image 45
nawfal Avatar answered Oct 11 '22 17:10

nawfal