inno setup win10 建立選單裡面解除安裝圖示
阿新 • • 發佈:2020-07-30
1、win10自己登錄檔關聯的解除安裝圖示 會隱藏 解除安裝圖示。現在的專案法是 不寫登錄檔 直接 在目標檔案裡面建立快捷方式 移動到選單裡面
; 指令碼由 Inno Setup 指令碼嚮導 生成! ; 有關建立 Inno Setup 指令碼檔案的詳細資料請查閱幫助文件! #define MyAppName "" #define Close "解除安裝" #define MyAppVersion "1.0" #define MyAppPublisher "" #define MyAppExeName ".exe" #define MyUnins "解除安裝.exe" [Setup] ; 注: AppId的值為單獨標識該應用程式。 ; 不要為其他安裝程式使用相同的AppId值。 ; (若要生成新的 GUID,可在選單中點選 "工具|生成 GUID"。) AppId= AppName={#MyAppName} AppVersion={#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} DefaultDirName={autopf}\{#MyAppName} DefaultGroupName=採集工具2.0 DisableProgramGroupPage=yes ; 以下行取消註釋,以在非管理安裝模式下執行(僅為當前使用者安裝)。 ;PrivilegesRequired=lowest OutputBaseFilename=採集工具2.0 Compression=lzma SolidCompression=yes WizardStyle=modern PrivilegesRequired=admin [Languages] Name: "chinesesimp"; MessagesFile: "compiler:Default.isl" [code] procedure CurStepChanged(CurStep: TSetupStep); var uninspath, uninsname, NewUninsName, MyAppName: string; begin if CurStep=ssDone then begin // 指定新的解除安裝檔名(不包含副檔名),請相應修改! NewUninsName := '解除安裝'; // 應用程式名稱,與 [Setup] 段的 AppName 必須一致,請相應修改! MyAppName := '採集工具'; // 以下重新命名解除安裝檔案 uninspath:= ExtractFilePath(ExpandConstant('{uninstallexe}')); uninsname:= Copy(ExtractFileName(ExpandConstant('{uninstallexe}')),1,8); RenameFile(uninspath + uninsname + '.exe', uninspath + NewUninsName + '.exe'); RenameFile(uninspath + uninsname + '.dat', uninspath + NewUninsName + '.dat'); // 以下修改相應的登錄檔內容 if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + MyAppName + '_is1') then begin RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + MyAppName + '_is1', 'UninstallString', '"' + uninspath + NewUninsName + '.exe"'); RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + MyAppName + '_is1', 'QuietUninstallString', '"' + uninspath + NewUninsName + '.exe" /silent'); end; end; end; [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone ;Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] Source: "E:\client\新建資料夾 (2)\people\people\bin\Release\採集工具.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "E:\client\新建資料夾 (2)\people\people\bin\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs ; 注意: 不要在任何共享系統檔案上使用“Flags: ignoreversion” [Icons] ;Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; ;Name: "{commonprograms}\解除安裝 {#MyAppName}"; Filename:{uninstallexe}; WorkingDir: {app}; ;Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon ; //開始選單快捷方式 Name: "{commonprograms}\{#MyAppName}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; WorkingDir: {app}; //桌面快捷方式 Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon //開始選單解除安裝程式 ;Name: {commonprograms}\{#MyAppName}\解除安裝 {#MyAppName}; Filename:{uninstallexe}; WorkingDir: {app}; Name: {commonprograms}\{#MyAppName}\解除安裝 {#MyAppName}; Filename:{app}\{#MyUnins}; WorkingDir: {app}; ;Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; ;解除安裝程式圖示 ;Name: "{group}\{#Close}"; Filename: "{uninstallexe}"; ;主程式圖示 ;Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" ;Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon ;桌面解除安裝程式圖示 ;Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon [Registry] Root: HKCR; Subkey: ".zjx"; ValueType: string; ValueName: ""; ValueData: "採集工具" Root: HKCR; Subkey: "息採集工具\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"; Flags: uninsdeletekey Root: HKCR; Subkey: "採集工具\Shell\Open\Command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" %1"; Flags: uninsdeletekey Root: HKCR; Subkey: "息採集工具\ShellNew"; ValueType: string; ValueName: "FileName"; ValueData: """{app}\{#MyAppExeName}"" %1"; Flags: uninsdeletekey [Run] Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent