Using this:
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
I get this output:
"C:\\Documents and Settings\\[USER]\\Application Data"
How can I get the root directory of all users? i.e.:
"C:\\Documents and Settings\\[USER]\\"
To navigate to your home directory, use "cd" or "cd ~" To navigate up one directory level, use "cd .." To navigate to the previous directory (or back), use "cd -" To navigate through multiple levels of directory at once, specify the full directory path that you want to go to.
To find your Home folder, open Finder and use the keyboard shortcut Command-Shift-H. You can use the Go pull-down menu from the menu bar to go to the Home folder. (Oddly, the home folder is called Home in this menu.)
Swift – Home Directory for Current User To get home directory for current user in Swift, read homeDirectoryForCurrentUser property of shared file manager object for the process.
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With