Per-User Application Settings Locations (UAC)

Per-User Application Settings Locations

For Windows Vista®, the application settings that need to be changed at run time should be stored in one of the following locations:

  • CSIDL_APPDATA

  • CSIDL_LOCAL_APPDATA

  • CSIDL_COMMON_APPDATA

Documents saved by the user should be stored in CSIDL_MYDOCUMENTS.

Note

A user's Documents folder is no longer stored under Documents and Settings. In Windows Vista, a new root directory on the file system called Users now contains the profiles for users of the computer.

Because these directories have changed, developers are encouraged to use CSIDLs to locate the path to specific well-known directories in a system-independent way. For more information, see the MSDN article on CSIDLs (https://go.microsoft.com/fwlink/?LinkId=71501).

An application needs write access to the file system. When running under a managed desktop, an application only has write permission to the following folders and their children.

  • CSIDL_PROFILE

  • CSIDL_COMMON_APPDATA

Note

Standard users cannot write to Users\Common.

  • C:\Users\Common>cd "Application Data"

    • C:\Users\Common\Application Data>echo File > File.txt

    • C:\Users\Common\Application Data>

Applications should not attempt to write to other locations, such as the following:

  • C:\Windows

  • C:\Windows\System32

  • Program Files\{application}

  • C:\{application}

Note

This will work if the user created the folder, which members of the Users group can do by default.

An application is trying to specifically create C:\Users\Profiles\Username is not allowed since the user can only create folders under C:\Users\Username. The location chosen appears to be confused based on where Microsoft has stored the Documents folder on previous versions of the operating system.

Application settings that need to be changed at run time should be stored in one of the following locations:

  • CSIDL_APPDATA

  • CSIDL_LOCAL_APPDATA

  • CSIDL_COMMON_APPDATA

Documents saved by the user should be stored in the CSIDL_MYDOCUMENTS folder.

All paths should not be hard-coded but should use the Environment.GetFolderPath() function.

See Also

Concepts

Troubleshooting UAC