vista 程序数据命令行访问
我有一个将数据(original.dat)存储到文件夹 C:\ProgramData 的应用程序 (我使用 SHGetFolderPath() 和 CSIDL_COMMON_APPDATA 的 CSIDL 来访问该文件夹)
它还需要使用参数调用命令行执行文件(myexecute.exe) c:\program files\myname\appname\myexecute.exe original.dat outputfile.dat(outputfile.dat 将位于 C:\ProgramData 中) 它在 xp 上运行,但在 vista 上报告错误“访问被拒绝”。 看起来预示着要在文件夹中创建outputfile.dat。
任何评论
谢谢马克
欢迎
I have an application which stores data (original.dat ) to folder C:\ProgramData
(I use SHGetFolderPath() with CSIDL of CSIDL_COMMON_APPDATA. to access the folder)
It also need to call a command line execute file(myexecute.exe) with parameter
c:\program files\myname\appname\myexecute.exe original.dat outputfile.dat (outputfile.dat will be in C:\ProgramData)
It worked on xp, but it reported error 'access denied' on vista.
It look like it is foreboded for creating the outputfile.dat in the folder.
Welcome any comment
Thanks
marc
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
CSIDL_COMMON_APPDATA 适用于所有用户,由于 UAC,非管理员用户不可写。管理员在安装过程中可以写入它,但安装后不应使用。
您应该使用 CSIDL_APPDATA 作为当前用户的数据。
CSIDL_COMMON_APPDATA is for all users, and is not writable for non-admin users because of UAC. It's writable for administrators during install, but shouldn't be used afterwards.
You should use CSIDL_APPDATA for the current user's data instead.