windows – Inno Setup – 如何在安装Google Chrome时告知安装,它应该打开stackoverflow.com?

前端之家收集整理的这篇文章主要介绍了windows – Inno Setup – 如何在安装Google Chrome时告知安装,它应该打开stackoverflow.com?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
通过以下方式: https://productforums.google.com/forum/#!topic/chrome/8XnSOnhLBzA

>去http://ninite.com/chrome/获得他们的chrome安装程序(但这并没有帮助我,因为我需要在安装Google Chrome后最终打开一个特定的网站)
>现在我正在尝试自己使用Inno Setup,以确保我和Ninite几乎相同
>一旦Inno Setup完成Google Chrome安装,我如何确保使用Google Chrome打开www.stackoverflow.com?

这是我的Inno Setup代码,在第3点没有正确执行:

>安装谷歌浏览器
>安装执行谷歌浏览器后
>但我怎么能告诉谷歌Chrome – 执行第一个链接:www.stackoverflow.com?

  1. ; Script generated by the Inno Setup Script Wizard.
  2. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
  3.  
  4. #define MyAppName "My Program"
  5. #define MyAppVersion "1.5"
  6. #define MyAppPublisher "My Company,Inc."
  7. #define MyAppURL "http://www.example.com/"
  8. #define MyAppExeName "ChromeSetup (1).exe"
  9.  
  10. [Setup]
  11. ; NOTE: The value of AppId uniquely identifies this application.
  12. ; Do not use the same AppId value in installers for other applications.
  13. ; (To generate a new GUID,click Tools | Generate GUID inside the IDE.)
  14. AppId={{FCF7940A-D96F-4A7A-9C69-C9DFE8BB308A}
  15. AppName={#MyAppName}
  16. AppVersion={#MyAppVersion}
  17. ;AppVerName={#MyAppName} {#MyAppVersion}
  18. AppPublisher={#MyAppPublisher}
  19. AppPublisherURL={#MyAppURL}
  20. AppSupportURL={#MyAppURL}
  21. AppUpdatesURL={#MyAppURL}
  22. DefaultDirName={pf}\{#MyAppName}
  23. DefaultGroupName={#MyAppName}
  24. OutputDir=C:\Users\sun\Desktop\Nieuwe map
  25. OutputBaseFilename=setup
  26. Compression=lzma
  27. SolidCompression=yes
  28.  
  29. [Languages]
  30. Name: "english"; MessagesFile: "compiler:Default.isl"
  31.  
  32. [Tasks]
  33. Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
  34.  
  35. [Files]
  36. Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
  37. Source: "C:\Users\sun\Downloads\ChromeSetup (1).exe"; DestDir: "{app}"; Flags: ignoreversion
  38. ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
  39.  
  40. [Icons]
  41. Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
  42. Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
  43.  
  44. [Run]
  45. Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName,'&','&&')}}"; Flags: nowait postinstall skipifsilent
以下可能有用,因为我所指的注册表项在 official docs中针对Chrome安装程序进行了描述.有一个注册表项直接包含chrome.exe文件的路径,因此它是恕我直言,是获取Chrome应用程序的最佳选择.文件名.这是关键:
  1. <root>\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe

其中< root>是HKEY_LOCAL_MACHINE还是HKEY_CURRENT_USER注册表根目录,具体取决于是为当前用户安装了Chrome还是为整个系统安装了Chrome.

在以下脚本中,我使用上述密钥不仅可以获取Chrome应用.文件名,但即使是用于确定Chrome是否已安装:

  1. [Files]
  2. Source: "chrome_installer.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
  3.  
  4. [Run]
  5. Filename: "{tmp}\chrome_installer.exe"; Check: not IsChromeInstalled
  6. Filename: "{code:GetChromeFileName}"; Parameters: "www.stackoverflow.com"; \
  7. Check: IsChromeInstalled
  8.  
  9. [Code]
  10. const
  11. ChromeAppRegKey = 'Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe';
  12.  
  13. function IsChromeInstalled: Boolean;
  14. begin
  15. { check if there's the Chrome app registration entry under the HKCU,or }
  16. { HKLM root key,return the result }
  17. Result := RegKeyExists(HKEY_CURRENT_USER,ChromeAppRegKey) or
  18. RegKeyExists(HKEY_LOCAL_MACHINE,ChromeAppRegKey);
  19. end;
  20.  
  21. function GetChromeFileName(Value: string): string;
  22. var
  23. S: string;
  24. begin
  25. { initialize returned value to an empty string }
  26. Result := '';
  27. { first attempt to read the Chrome app file name from the HKCU root key; }
  28. { if that fails,try to read the same from HKLM; if any of that succeed,}
  29. { return the obtained registry value }
  30. if RegQueryStringValue(HKEY_CURRENT_USER,ChromeAppRegKey,'',S) or
  31. RegQueryStringValue(HKEY_LOCAL_MACHINE,S)
  32. then
  33. Result := S;
  34. end;

猜你在找的Windows相关文章