Windows 7 - 无法在 C:\Program Files 中更新我的程序文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6281696/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Windows 7 - Can't update my program's files in C:\Program Files
提问by Julie Stein
I have an addin program that works with MS Word (version 2007). It is located in the C:\Program Files location. I installed Windows 7 and then went to make a routine change to my files in this location and it would only bring up a read only file. How can I grant myself permission to write to my own program? I cannot change this location or use any other workaround. I have this product out to 25 different companies and I can't change the programming to work from any other location. Thanks
我有一个适用于 MS Word(2007 版)的插件程序。它位于 C:\Program Files 位置。我安装了 Windows 7,然后在这个位置对我的文件进行了例行更改,它只会调出一个只读文件。如何授予自己写入自己程序的权限?我无法更改此位置或使用任何其他解决方法。我将此产品分发给 25 家不同的公司,我无法更改编程以在任何其他位置工作。谢谢
回答by Vincent Koeman
You could also embed a manifestin your EXE that makes your program require adminrights on Windows 7 / Vista.
您还可以在您的 EXE 中嵌入一个清单,使您的程序在 Windows 7 / Vista 上需要管理员权限。
回答by David Heffernan
On Windows Vista, UAC means that users run without admin rights and don't have write access to the program files directories.
在 Windows Vista 上,UAC 意味着用户在没有管理员权限的情况下运行,并且没有对程序文件目录的写访问权限。
The correct solution is to write to a folder for which standard users do have write permissions.
正确的解决方案是写入标准用户具有写入权限的文件夹。
The solution you are looking for is to make your app's folder within program files writeable to all users. You can do this by adding a DACL when installing. It is extremely bad practice to allow standard users to write inside the program files directory and I urge you instead to re-code your app so that it does not need to write there.
您正在寻找的解决方案是使您的应用程序文件夹中的程序文件可写入所有用户。您可以通过在安装时添加 DACL 来完成此操作。允许标准用户在程序文件目录中写入是非常糟糕的做法,我敦促您重新编码您的应用程序,以便它不需要在那里写入。
回答by Daniel Kitchener
Assuming you're doing this as part of modifying the config (and not when your application is running for regular users)...
假设您这样做是作为修改配置的一部分(而不是在您的应用程序为普通用户运行时)...
Your user account probably doesn't have the correct permissions to write/modify the file. Assuming your account is an administrator account, right-click the file, select "Properties". Click the "Security" tab. Click edit and give your user account Full Control.
您的用户帐户可能没有正确的权限来写入/修改文件。假设您的帐户是管理员帐户,右键单击该文件,选择“属性”。单击“安全”选项卡。单击编辑并授予您的用户帐户完全控制权。
If you can't do this, it's probably because the ownership of the file doesn't allow you. If this is the case, click on "Advanced", go to the "Owner" tab, and click "Edit".
如果您不能这样做,可能是因为文件的所有权不允许您这样做。如果是这种情况,请单击“高级”,转到“所有者”选项卡,然后单击“编辑”。
However, if it needs these permissions when it's running, you should instead be using the %AppData% folder.
但是,如果它在运行时需要这些权限,您应该使用 %AppData% 文件夹。