Saving Data: Program Files vs AppData in Windows

windows

My question is, why do programs save their data in the AppData folder and not in their Program Files' installation folder? Do they actually store all their local data in the AppData folder, or can they store it wherever they like? For example, an offline game or a browser.

Best Answer

The location of the folder itself actually answers the question. But for clarity, let me explain anyway.

The AppData folder is located in a user's folder, eg: C:\Users\Username\AppData, whereas the program files folder is located in C:\

The biggest difference here is permissions. If you have just one user on your pc, then that user has all rights everywhere and it may not make sense. But if you have multiple users, then it starts to make sense. Each individual user has its own folder in C:\Users, with their own AppData folder. Not only does this mean that other users do not have access to your AppData folder, but it also allows one program to be installed just once, yet have settings for every user.

For example, if you have Mozilla Thunderbird or Microsoft Outlook (they are email clients for those who are not aware of either), you would not want to install the application again and again for every user. You would rather want to install the application just once, but have different settings per users. Because not every user will have the same email address.

For that reason, AppData exists. For a users's settings.

A second reason is security. Although Program Files could be the place for programs that just perform a task and have no settings, if a user is not an administrator on that pc, they cannot write to the Program Files folder, so the program itself cannot make changes at all. In AppData however, the user always have rights to write there, even if they are not administrators. So a program that needs to write data, for example a webbrowser with its cache will have to use AppData to write that cache or the user would get an UAC prompt asking for administrative access everytime they start the program.

Related Question