简体   繁体   English

存储具有所有用户的读/写权限的应用程序数据的最佳目录?

[英]Best directory to store application data with read\write rights for all users?

Until Windows Vista I saved my application data into the directory where the program was located. 在Windows Vista之前,我将应用程序数据保存到程序所在的目录中。 The most common place was "C:\\Program Files\\MyApplication". 最常见的地方是“C:\\ Program Files \\ MyApplication”。 As we know, under Vista and later the common user does't have rights to write under "Program Files" folder. 我们知道,在Vista之后,普通用户无权在“Program Files”文件夹下写入。 So my first idea was to save the application data under the "All Users\\Application Data" folder. 所以我的第一个想法是将应用程序数据保存在“所有用户\\应用程序数据”文件夹下。 But it seems that this folder has writing restrictions too! 但似乎这个文件夹也有写作限制!

So to sum up, my requirements are: 总而言之,我的要求是:

  • The folder should exist under Windows XP and above. 该文件夹应存在于Windows XP及更高版本中。
  • All users of the system should have read\\write\\creation rights to this folder and its subfolders and files. 系统的所有用户都应具有对此文件夹及其子文件夹和文件的读\\写\\创建权限。
  • I want to have only one copy of file\\files for all users. 我想只有一个文件\\文件副本的所有用户。

It's often good to use environment variables so you keep things more generic. 使用环境变量通常很好,所以你可以保持更通用的东西。

Vista has changed some things, with NTFS Junction Points. Vista改变了一些东西,NTFS连接点。 See http://www.svrops.com/svrops/articles/jpoints.htm http://www.svrops.com/svrops/articles/jpoints.htm

Anyway, using %appdata% should automagically put files in the proper place on xp/vista/7 无论如何,使用%appdata%应该自动将文件放在xp / vista / 7上的适当位置

There is no such location. 没有这样的位置。 Even on Windows XP (and probably 2000 as well) no such location ever existed; 即使在Windows XP(也可能是2000年)上,也不存在这样的位置; we just think it did because we all ran with administrative privileges. 我们认为这样做是因为我们都运行了管理权限。 It is not until Vista forces us to run as limited user that we realize our incorrect assumptions. 直到Vista强迫我们以有限的用户身份运行才意识到我们的错误假设。 You're going to have to explicitly set the permissions on your directory. 您将不得不明确设置目录的权限。

我将创建一个像所有用户\\应用程序数据\\ YourAppName \\ Shared这样的子文件夹,以便明确该文件夹将包含所有用户可写的文件,并在安装程序中设置权限。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用于存储每个机器应用程序文件(xml)的目录,以便我的所有用户(使用应用程序)都可以对其进行读写 - Directory to store per machine application file (xml) such that my all users(using application) can read/write to it 在Windows上的用户之间共享读/写应用程序数据(在磁盘上) - Share read/write application data (on disk) between users on Windows 为所有用户安装应用程序是否需要管理员权限? - Are admin rights required for installing an app for all users? 为所有用户存储注册表数据的位置 - Where to store Registry data for All Users 如何创建具有授予每个人的所有权限的目录 - How to create directory with all rights granted to everyone 如何编写批处理文件以裁剪目录中的所有pdf文件并将其存储在新目录中? - How to write a batch file to crop all the pdfs in a directory and store them in a new directory? 无法创建数据目录 - Google Chrome 无法读取和写入其数据目录 - Cordova - Failed to Create Data Directory - Google Chrome Cannot Read and Write Its Data Directory - Cordova WINAPI 读取自定义文件或文件夹的所有访问权限 - WINAPI Read all access rights for a custom file or a folder Windows服务,用于控制对“所有用户\\应用程序数据”中文件的访问 - Windows service to control access to a file in “All Users\Application Data” 目录所有Windows用户共有 - Directory Common to all windows users
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM