I'm trying to use an application settings property to populate a TextBox
with a user's My Documents folder. I can't seem to figure out how to use the %USERPROFILE% environment variable to get at it though.
I've tried $(USERPROFILE)\My Documents for the default value of the property, but that doesn't work.
You can get the My Documents folder with Environment.GetFolderPath()
.
using System;
string myDocuments = Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments );
Use Environment.SpecialFolder.UserProfile
to get the user's profile folder instead.
MSDN link.