Try:
System.Environment.GetEnvironmentVariable("USERPROFILE");
Edit:
If the version of .NET you are using is 4 or above, you can use the Environment.SpecialFolder
enumeration:
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
More Related Contents:
- sender as in C# [duplicate]
- CMD command on c#
- How can I update the current line in a C# Windows Console App?
- How to deal with files with a name longer than 259 characters?
- How to get Windows Display settings?
- How can I run another application within a panel of my C# program?
- How can I get the child windows of a window given its HWND?
- Detect active window changed using C# without polling
- Write to Windows Application Event Log without event source registration
- Programmatically add an application to Windows Firewall
- Enumerate windows like alt-tab does
- Is there Windows system event on active window changed?
- Which PID listens on a given port in c#
- “Invalid provider type specified” CryptographicException when trying to load private key of certificate
- How to interact with Windows Media Player in C#
- .NET FileInfo.LastWriteTime & FileInfo.LastAccessTime are wrong
- Change Language in C#
- Determine OS using Environment.OSVersion [duplicate]
- find all ip address in a network
- Start a windows service and launch cmd
- Is there a way to convert a System.IO.Stream to a Windows.Storage.Streams.IRandomAccessStream?
- How to stop Windows service programmatically
- How to create a Process that outlives its parent
- How do I compute the non-client window size in WPF?
- Get list of local computer usernames in Windows
- How do I detect when a directory or file changes without constant scanning
- Install Windows Service created in Visual Studio
- The type ‘System.IDisposable’ is defined in an assembly that is not referenced
- Detect if non DPI-aware application has been scaled/virtualized
- How to know when was Windows started or shutdown?