How do I find the application data folder path for all Windows users from C#?
How do I find this for the current user and other Windows users?
This will give you the path to the "All users" application data folder.
string path = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                        Adapted from @Derrick's answer. The following code will find the path to Local AppData for each user on the computer and put the paths in a List of strings.
        const string regKeyFolders = @"HKEY_USERS\<SID>\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders";
        const string regValueAppData = @"Local AppData";
        string[] keys = Registry.Users.GetSubKeyNames();
        List<String> paths = new List<String>();
        foreach (string sid in keys)
        {
            string appDataPath = Registry.GetValue(regKeyFolders.Replace("<SID>", sid), regValueAppData, null) as string;
            if (appDataPath != null)
            {
                paths.Add(appDataPath);
            }
        }
                        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