I am currently trying to use the following to access a computer's local AppData folder:

Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

This returns something along the lines of C:\\Users\\[USERNAME]\\AppData\\Roaming. What I want is to get the default AppData folder, as opposed to any specific user's folder.

I can hard code this C:\Users\Default\AppData\Local, but I'd feel more comfortable if there was a function that provided what I'm looking for.

Is there such a function, and if so, what is it?

有帮助吗?

解决方案

I believe SpecialFolder.CommonApplicationData will get what you need.

From the MSDN documentation:

The directory that serves as a common repository for application-specific data that is used by all users.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top