Question

Is there a .NET variable that returns the "All Users" directory?

Was it helpful?

Solution

You'll want to use the system.environment variables.
Most of the predefined ones are shown here.

For the "All Users" you would use:

System.Environment.GetEnvironmentVariable("ALLUSERSPROFILE")

I know I got a lot of upmods and a correct answer for my other stuff, but this actually works. where as the other environment variables I linked to previously don't seem to work with that function call.

OTHER TIPS

Or,

Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)

You can then pass this result to System.IO.Directory.GetParent() to get the root "All Users" folder.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top