Sartheris Stormhammer
Sartheris Stormhammer

Reputation: 2564

C# Access user folder in Windows XP

For Windows Vista and up, the user folder C:\Users\MyUser the folder is accessed programatically like this

Environment.ExpandEnvironmentVariables(@"%userprofile%\");

How do I access the user folder in XP? Like this

C:\Documents and Settings\MyUser\

EDIT: I am using Framework 2.0

Upvotes: 0

Views: 144

Answers (1)

Alex K.
Alex K.

Reputation: 175826

Use the SpecialFolder enumeration (.Net 4)

Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)

Upvotes: 2

Related Questions