views:

372

answers:

3

how to get %LocalAppData% in visual studio c#?

+2  A: 

Environment.GetEnvironmentVariable("LocalAppData") for C#, since Visual Studio isn't a language, unless you're looking to get that variable in one of the VS dialogs or something.

Kristopher Ives
I have edited my post.Environment.GetEnvironmentVariable("LocalAppData") for C# works.Thanks
Dee
A: 

If you're dealing with native code, the APIs you need to read up on are SHGetKnownFolderPath (Vista and later) or SHGetFolderPath (2000/XP).

Bob Moore
Hmmm... the C# got added to the question in an edit. So I want to delete this post. But I can't... why can't you delete your own posts, only vote for them to be deleted? This seems like lunacy to me.
Bob Moore
+2  A: 

If you would like to use an enumeration, try the following:

Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)

Using this technique, you can also find all other Window's file paths (i.e Program Files, My Documents, etc).

Blake Blackwell