windows – Inno Setup – 如何在安装Google Chrome时告知安装,
发布时间:2020-12-13 20:32:34 所属栏目:Windows 来源:网络整理
导读:通过以下方式: https://productforums.google.com/forum/#!topic/chrome/8XnSOnhLBzA 去http://ninite.com/chrome/获得他们的chrome安装程序(但这并没有帮助我,因为我需要在安装Google Chrome后最终打开一个特定的网站) 现在我正在尝试自己使用Inno Setup,
通过以下方式:
https://productforums.google.com/forum/#!topic/chrome/8XnSOnhLBzA
>去http://ninite.com/chrome/获得他们的chrome安装程序(但这并没有帮助我,因为我需要在安装Google Chrome后最终打开一个特定的网站) 这是我的Inno Setup代码,在第3点没有正确执行: >安装谷歌浏览器 ; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "My Program" #define MyAppVersion "1.5" #define MyAppPublisher "My Company,Inc." #define MyAppURL "http://www.example.com/" #define MyAppExeName "ChromeSetup (1).exe" [Setup] ; NOTE: The value of AppId uniquely identifies this application. ; Do not use the same AppId value in installers for other applications. ; (To generate a new GUID,click Tools | Generate GUID inside the IDE.) AppId={{FCF7940A-D96F-4A7A-9C69-C9DFE8BB308A} AppName={#MyAppName} AppVersion={#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={pf}{#MyAppName} DefaultGroupName={#MyAppName} OutputDir=C:UserssunDesktopNieuwe map OutputBaseFilename=setup Compression=lzma SolidCompression=yes [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] Source: "C:Program Files (x86)Inno Setup 5ExamplesMyProg.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "C:UserssunDownloadsChromeSetup (1).exe"; DestDir: "{app}"; Flags: ignoreversion ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] Name: "{group}{#MyAppName}"; Filename: "{app}{#MyAppExeName}" Name: "{commondesktop}{#MyAppName}"; Filename: "{app}{#MyAppExeName}"; Tasks: desktopicon [Run] Filename: "{app}{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName,'&','&&')}}"; Flags: nowait postinstall skipifsilent
以下可能有用,因为我所指的注册表项在
official docs 中针对Chrome安装程序进行了描述.有一个注册表项直接包含chrome.exe文件的路径,因此它是恕我直言,是获取Chrome应用程序的最佳选择.文件名.这是关键:
<root>SoftwareMicrosoftWindowsCurrentVersionApp Pathschrome.exe 其中< root>是HKEY_LOCAL_MACHINE还是HKEY_CURRENT_USER注册表根目录,具体取决于是为当前用户安装了Chrome还是为整个系统安装了Chrome. 在以下脚本中,我使用上述密钥不仅可以获取Chrome应用.文件名,但即使是用于确定Chrome是否已安装: [Files] Source: "chrome_installer.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall [Run] Filename: "{tmp}chrome_installer.exe"; Check: not IsChromeInstalled Filename: "{code:GetChromeFileName}"; Parameters: "www.stackoverflow.com"; Check: IsChromeInstalled [Code] const ChromeAppRegKey = 'SoftwareMicrosoftWindowsCurrentVersionApp Pathschrome.exe'; function IsChromeInstalled: Boolean; begin { check if there's the Chrome app registration entry under the HKCU,or } { HKLM root key,return the result } Result := RegKeyExists(HKEY_CURRENT_USER,ChromeAppRegKey) or RegKeyExists(HKEY_LOCAL_MACHINE,ChromeAppRegKey); end; function GetChromeFileName(Value: string): string; var S: string; begin { initialize returned value to an empty string } Result := ''; { first attempt to read the Chrome app file name from the HKCU root key; } { if that fails,try to read the same from HKLM; if any of that succeed,} { return the obtained registry value } if RegQueryStringValue(HKEY_CURRENT_USER,ChromeAppRegKey,'',S) or RegQueryStringValue(HKEY_LOCAL_MACHINE,S) then Result := S; end; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- windows-phone-7 – 是否有任何现成的wp7地图控件?
- windows-8 – 将本地HTML加载到WebView中
- Windows Server 2016的2节点集群(主动 – 被动)
- Windows Server与常规Windows有何不同?
- 如何从批处理文件中将行号添加到文本文件中(Windows)
- 如何使用Windows身份验证与System.Data.OracleClient连接到
- windows – 如何在批处理脚本中使用通配符和需要特定文件名
- windows-server-2003 – 打开certmgr.msc以显示计算机级别证
- .net – 如何异步打开Windows中的文件
- 打印 – 如何使用fmt在Go中打印出常量uint64?