在本地用户之间交换数据的正确 Windows 文件夹是什么?
我想在本地常规用户帐户下运行的应用程序中写入一个文件并在服务中读取它。正确的文件夹是什么?
我想避免使用 %APPDATA%
(CSIDL_APPDATA
) 文件夹,因为服务需要了解该文件夹的位置(服务在系统帐户下运行)。我检查了 %ALLUSERSPROFILE%
(是 CSIDL_COMMON_APPDATA
吗?),它指向我的 Win7 x64 上的 c:\ProgramData
。但此文件夹不允许普通本地用户修改(我签入了文件夹 properties
、security
选项卡)。 %CommonProgramFiles%
也是如此。
我需要支持 WinXP 及更高版本。
I want to write a file in app running under local regular user account and read it in service. What's the right folder?
I'd like to avoid %APPDATA%
(CSIDL_APPDATA
) folder because service would need to realize where's this folder are (service is running under system account). I checked %ALLUSERSPROFILE%
(is it CSIDL_COMMON_APPDATA
?), it points to c:\ProgramData
on my Win7 x64. But this folder doesn't allows modification for regular local users (I checked in folder properties
, security
tab). The same about %CommonProgramFiles%
.
I need to support WinXP and up.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当我遇到类似情况时,我没有找到这样的文件夹。简单的解决方案是在安装期间(或从服务)在 CSIDL_COMMON_APPDATA 文件夹中创建一个文件夹,并具有允许普通用户写入此文件夹的特殊权限。
I found no such folder when I was in similar situation. The simple solution is to create a folder in CSIDL_COMMON_APPDATA folder during installation (or from the service) with special permissions that allow normal users to write to this folder.
我认为您需要
CSIDL_COMMON_DOCUMENTS
(或FOLDERID_PublicDocuments
),即共享文档文件夹。在 XP 下,它类似于c:\Documents and Settings\All Users\Documents
。I think you need
CSIDL_COMMON_DOCUMENTS
(orFOLDERID_PublicDocuments
), that is the Shared Documents folder. Under XP it would be something likec:\Documents and Settings\All Users\Documents
.