windows 像谷歌浏览器一样在 AppData 中安装程序有什么好处?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47639/
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
What are the advantages of installing programs in AppData like Google Chrome?
提问by Ravi Chhabra
I just noticed that Chromium was installed in AppData in both Vista and XP. If Google does that and if other applications does this, than is that becuase there is some form of protection? Should we write installers that does the same thing as Google?
我刚刚注意到在 Vista 和 XP 中的 AppData 中都安装了 Chromium。如果谷歌这样做,如果其他应用程序这样做,那是因为有某种形式的保护吗?我们是否应该编写与 Google 具有相同功能的安装程序?
回答by S?ren Kuklau
Windows still lacks a convention for per-user installation.
Windows 仍然缺乏按用户安装的约定。
- When an installer asks whether to install for the current user or all users, it really only refers to shortcut placement (Start Menu; Desktop). The actual application files still go in the system-wide
%PROGRAMFILES%
. - Microsoft's own ClickOnce works around this by creating a completely non-standard
%USERPROFILE%\Local Settings\Apps
(%USERPROFILE%\AppData\Roaming
on Vista / Server 2008) directory, with both program files and configuration data in there.
- 当安装程序询问是为当前用户安装还是为所有用户安装时,它实际上只是指快捷方式的放置(开始菜单;桌面)。实际的应用程序文件仍然在系统范围的
%PROGRAMFILES%
. - Microsoft 自己的 ClickOnce 通过创建一个完全非标准的
%USERPROFILE%\Local Settings\Apps
(%USERPROFILE%\AppData\Roaming
在 Vista / Server 2008 上)目录来解决这个问题,其中包含程序文件和配置数据。
(I'm at a loss why Microsoft couldn't add a per-user Program Files directory in Vista. For example, in OS X, you can create a ~/Applications
, and the Finder will give it an appropriate icon. Apps like CrossOver and Adobe AIR automatically use that, defaulting to per-user apps. Thus, no permissions issues.)
(我不知道为什么微软不能在 Vista 中添加每个用户的 Program Files 目录。例如,在 OS X 中,你可以创建一个~/Applications
,然后 Finder 会给它一个合适的图标。像 CrossOver 和 Adobe 这样的应用程序AIR 自动使用它,默认为每个用户的应用程序。因此,没有权限问题。)
What you probably shoulddo: if the user is not an admin, install in the user directory; if they do, give them both options.
您可能应该做的:如果用户不是管理员,请安装在用户目录中;如果他们这样做,给他们两个选择。
回答by Kugel
One advantage nobody mentioned are silent auto-updates. Chrome has an updater process that runs all the time and immediately updates your chrome installation.
没有人提到的一项优势是静默自动更新。Chrome 有一个更新程序,它会一直运行并立即更新您的 chrome 安装。
I think their use-case is non-standard. They need a way to fix vulnerability issues (since it's a browser) as soon as possible. Waiting for admins approving every single update company-wide, is simply not good enough.
我认为他们的用例是非标准的。他们需要一种方法来尽快修复漏洞问题(因为它是浏览器)。等待管理员批准公司范围内的每一个更新,根本不够好。
回答by vt.
As far as I can tell, the only reason why Chrome installs into the Application Data folder is so that non-admin users can install it.
据我所知,Chrome 安装到 Application Data 文件夹的唯一原因是非管理员用户可以安装它。
The Chrome installer currently does not allow the user to pick where the application is to be installed. Don't do that – instead, give the user a choice between a per-user (somewhere like App Data) and computer-wide (Program Files) installation.
Chrome 安装程序目前不允许用户选择应用程序的安装位置。不要那样做——相反,让用户在每个用户(如应用程序数据)和计算机范围(程序文件)安装之间进行选择。
回答by vt.
Windows 7 and Windows Installer 5.0 provide real per-user installation capabilities now.
Windows 7 和 Windows Installer 5.0 现在提供真正的每用户安装功能。
http://msdn.microsoft.com/en-us/library/dd408068%28VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/dd408068%28VS.85%29.aspx
You can sort of fudge it in Vista and XP by using ~/AppData/Local or the equivalent like Chrome does. Microsoft themselves use this for the ClickOnce installers.
您可以在 Vista 和 XP 中使用 ~/AppData/Local 或类似 Chrome 的等效项来捏造它。Microsoft 自己将其用于 ClickOnce 安装程序。
So at least on Windows 7 and beyond the solution is simple.
因此,至少在 Windows 7 及更高版本上,解决方案很简单。
回答by Johannes Passing
Frankly, I have yet to see the first installer that really allows both per-user and per-machine installations. Many installers offer this option in their GUI, but the setting only affects where the shortcuts etc. go -- the binaries always fo to %ProgramFiles%.
坦率地说,我还没有看到第一个真正允许每用户和每台机器安装的安装程序。许多安装程序在其 GUI 中提供此选项,但该设置仅影响快捷方式等的位置——二进制文件始终为 %ProgramFiles%。
In fact, it is pretty hard to create Windows Installer packages that allow both kinds of installs, to say the least. With the advent of UAC, I'd say its is impossible: Per user installations must not require elevation, per machine installations have to. But whether an MSI package requires elevation is controlled via a bit in the summary information stream -- there is no way to have user input have impact on that.
事实上,至少可以说,创建允许两种安装的 Windows 安装程序包非常困难。随着 UAC 的出现,我想说这是不可能的:每个用户的安装必须不需要提升,每个机器的安装必须。但是 MSI 包是否需要提升是通过摘要信息流中的一个位来控制的——没有办法让用户输入对此产生影响。
Whether per-user or per-machine is the better choice greatly deoends on the application. For small packages, however, I tend to prefer per-user installations. Besides being slightly more user-friendly by not requiring an UAC prompt or runas, they also signalize the user that the setup will not do much harm to the computer (assuming he is a non-admin).
无论是按用户还是按机器是更好的选择,都极大地影响了应用程序。但是,对于小包,我倾向于按用户安装。除了不需要 UAC 提示或 runas 稍微更用户友好之外,它们还向用户发出信号,该设置不会对计算机造成太大伤害(假设他是非管理员)。
回答by DrPizza
The Chrome installer really ought to allow global installation (with elevation) in addition to per-user. I don't want to have to maintain an installation for every user; I want to be able to centrally manage upgrades and so on. Chrome doesn't allow that.
除了每个用户之外,Chrome 安装程序确实应该允许全局安装(带有提升)。我不想为每个用户维护一个安装;我希望能够集中管理升级等。Chrome 不允许这样做。
That said, the option to install per-user is quite nice, as it means no permissions issues.
也就是说,按用户安装的选项非常好,因为这意味着没有权限问题。
回答by msmechanized
Just so you people know, Google has created an MSI installer for global system installation and management. It's located here:
众所周知,Google 为全球系统安装和管理创建了 MSI 安装程序。它位于这里:
回答by Manly Electronics
I do not see anything in %PROGRAMFILES% on Win7. Looks like Chrome must be installed for each user on the machine.
我在 Win7 上的 %PROGRAMFILES% 中没有看到任何内容。看起来必须为机器上的每个用户安装 Chrome。
Perhaps the true reason of doing this is faking number of Chrome installations by few times ! Thus making it first browser in the world !
也许这样做的真正原因是将 Chrome 安装数量伪造了几次!从而使其成为世界上第一个浏览器!