Windows 7 中的可执行文件应该安装到哪里?
我目前正在开发我的应用程序安装程序,我想知道可执行文件应安装在 Windows 7 中的何处。
如果我以管理员身份安装,我的可执行文件将放置在 C:\Program Files 中。
如果我以普通用户身份安装我的产品,可执行文件应该放在哪里?
提前致谢。
I'm currently working on my applications installer and I'm wondering where the executable files should be installed to in Windows 7.
If I'm installing as admin my executables files get put in C:\Program Files.
If I install my product as a normal user where should the executables be put?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您使用哪个安装程序?
MSI 以提升的权限运行。您可以将应用程序安装在程序文件文件夹中
Which installer are you using?
MSI runs in elevated privileges. You can install your application in program files folder
将文件放入用户文件夹中。
这意味着该应用程序仅可供该用户使用。
Put the files in the user folder.
This will mean that the application is only available to that user.
您可能应该将其存储在 AppData 目录中,正如我看到您在回复 @ChrisF 时提到的那样。请记住,用户可以移动此目录,因此我不会明确指出它。您可以获取一个仅适用于登录用户的环境变量,即
%AppData%
。请记住,将其放入
%AppData%/Roaming
会在同一域上的多台计算机上跟踪用户,而%AppData%/Local
将仅保留在一台计算机上。You should probably store that in the AppData directry, as I saw you mention in reply to @ChrisF. Remember that the user can move this directory though, so I wouldn't point to it explicitly. There is an environment variable that you can grab, that only applies to the logged-in user, which is
%AppData%
.Keep in mind that putting it in
%AppData%/Roaming
would follow the user across multiple machines on the same Domain and%AppData%/Local
would just stay on the one machine.可执行文件应位于 Program Files 下,其确切位置可能因安装而异。这意味着设置应该以提升的速度运行。如果 InnoSetup 生成 .msi 文件,它们将请求提升。如果它创建一个名为 setup.exe 的文件,它也会请求提升。如果由于某种原因 exe 有不同的名称,例如 GetStarted.exe,那么您应该手动创建一个外部清单 (GetStarted.exe.manifest) 并放入 requestExecutionLevel 的 requireAdministrator 中,这将确保您的安装程序请求提升。
无论它如何请求提升,如果执行安装的用户是管理员(例如您),他们只需单击同意即可。如果他们不是管理员,则需要获得管理员的同意。之后安装程序将能够写入程序文件。
如果非管理员能够安装应用程序对您来说很重要,那么请将可执行文件放在用户配置文件下 - 但这不是我的第一选择。对程序文件的保护意味着,如果您将应用程序安装到受保护的区域,用户不太可能发现自己的应用程序副本混乱。
The executables should be under Program Files, who's precise location may vary from installation to installation. This means that the setup should run elevated. If InnoSetup makes .msi files, they will request elevation. If it makes a file called setup.exe, it will also request elevation. If for some reason the exe has a different name, like GetStarted.exe, then you should hand create an external manifest (GetStarted.exe.manifest) and put in requireAdministrator for the requestedExecutionLevel which will ensure your installer requests elevation.
Regardless of how it requests elevation, if the user doing the install is an admin (eg you) they will just have to click consent. If they are not an admin they will need to get an admin to consent for them. After that the installer will be able to write to Program Files.
If it's important to you that non admins be able to install the app then have the executables go under the users profile - but that would not be my first choice. The protection given to Program Files means that users are less likely to find themselves with messed up copies of your application if you install it to the protected area.