Vista and ProgramData

directoryprogramdatasharedwindows-vista

What is the right place to store program data files which are the same for every user but have to be writeable for the program? What would be the equivalent location on MS Windows XP? I have read that C:\ProgramData is not writeable after installation by normal users. Is that true? How can I retrieve that directory programmatically using the Platform SDK?

Best Answer

SHGetFolderPath() with CSIDL of CSIDL_COMMON_APPDATA.

Read more at http://msdn.microsoft.com/en-us/library/bb762181(VS.85).aspx

If you need the path in a batch file, you can also use the %ALLUSERSPROFILE% environment variable.