“程序文件"下的文件写入权限问题文件夹 [英] file write permission issue under "Program Files" folder

查看:24
本文介绍了“程序文件"下的文件写入权限问题文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用inno setup为我的应用程序制作安装包,我的应用程序是由C# + .Net 2.0 + VSTS 2008编写的.Inno setup => http://www.jrsoftware.org/isinfo.php 并且我在 Program Files/Foo 文件夹下安装我的应用程序(Foo 是我的应用程序名称).我的应用程序面向 Windows Vista.

I am using inno setup to make a installation package for my application, and my application is written by C# + .Net 2.0 + VSTS 2008. Inno setup => http://www.jrsoftware.org/isinfo.php and I install my application under Program Files/Foo folder (Foo is my application name). My application is targeting to Windows Vista.

我发现的问题是我的程序无法写入文件夹 Program Files/Foo.我需要写入这个文件夹的权限才能保存一些配置文件.我注意到的奇怪的事情是文件夹 Program Files/Foo 被标记为只读,我检查了 Program Files 下的所有文件夹都标记为只读,例如 Office.

The issue I found is my program cannot write to the folder Program Files/Foo. And I need the permission of write to this folder in order to save some configuration files. The strange thing I notice is the folder Program Files/Foo is marked as readonly and I have checked all folders under Program Files are marked with read only, such as Office.

我的问题是,

  1. 为什么所有文件夹都在 Program Files 下标记为只读?这意味着我们不应该写入 Program Files 下的单个应用程序文件夹?如果没有,我们应该将用户最后选择的单个应用程序的配置信息等信息写入磁盘的哪里?
  2. 如果我们可以写入 Program Files 下的单个应用程序文件夹,解决方案是什么?我不希望我的应用程序以管理员身份运行来解决这个问题,如果有写入这个文件夹的解决方案,如果可能的话,我希望需要最少的权限.

推荐答案

您应该使用 特殊文件夹枚举Enivronment.GetFolderPath.

这篇关于“程序文件"下的文件写入权限问题文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆