Question

When logged in as a user with administrative privileges, do apps automatically have the right to write to their own Program Files directory?

I'm persisting some data to the app directory and it's obviously not an issue in development because the app directory isn't under Program Files, but I just want to make sure I'm not going to run into any problems when I distribute the app. And the app will only be run by users with admin privileges.

Was it helpful?

Solution

Most anti-virus programs will throw a fit if they see any updates under the program files directory.

You'd be better off writing your data to a folder under the AppData folder

OTHER TIPS

No. Even a user who has administrative permissions by default runs in an non-elevated context. The user explicitly has to elevate in order to get permissions to write to that location.

You probably don't want to force the user to elevate just to save some data on behalf of that user. You probably also don't want to allow other users on the same machine to modify that data globally, nor do you want to disclose that data to other users.

AppData is the right spot for this sort of thing and has been for more than 10 years.

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