Inno Setup 指令碼

來源:互聯網
上載者:User

標籤:phi   tin   files   tps   config   string   產生   %s   plain   

給你個我用的例子:

Delphi/Pascal code ?
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 ; 指令碼用 Inno Setup 指令碼嚮導產生。; 查閱文檔擷取建立 INNO SETUP 指令檔詳細資料! [Setup]AppName=Common downloaderAppVerName=Common downloaderDefaultDirName={pf}\XXX\Common downloaderDefaultGroupName=XXX\Common downloaderDisableProgramGroupPage=yesOutputDir= .\SetupOutputBaseFilename=Common downloader setup V1.0.0Compression=lzmaSolidCompression=yesVersionInfoCompany=XXXVersionInfoVersion=1.0.0 [Languages]Name: "Chinese"; MessagesFile: "compiler:Languages\Chinese.isl"Name: "English"; MessagesFile: "compiler:Languages\English.isl" [Tasks]Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: dontinheritcheck [Files]Source: "CMDL.exe"; DestName: "Common downloader.exe"; DestDir: "{app}"; Flags: ignoreversionSource: "DL.dll"; DestDir: "{app}"; Flags: ignoreversionSource: "DM.dll"; DestDir: "{app}"; Flags: ignoreversionSource: "config.ini"; DestDir: "{app}"; Flags: ignoreversionSource: "App\*"; DestDir: "{app}\\App"; Flags: ignoreversion recursesubdirs createallsubdirsSource: "Boot\*"; DestDir: "{app}\\Boot"; Flags: ignoreversion recursesubdirs createallsubdirsSource: "Resource_cn\*"; DestDir: "{app}\Resource"; Languages: Chinese; Flags: ignoreversion recursesubdirs createallsubdirsSource: "Resource_en\*"; DestDir: "{app}\Resource"; Languages: English; Flags: ignoreversion recursesubdirs createallsubdirs; 注意: 不要在任何共用系統檔案中使用“Flags: ignoreversion” [Icons]Name: "{group}\Common downloader"; Filename: "{app}\Common downloader.exe"Name: "{group}\{cm:UninstallProgram,Common downloader}"; Filename: "{uninstallexe}"Name: "{userdesktop}\Common downloader"; Filename: "{app}\Common downloader.exe"; Tasks: desktopicon [Run]Filename: "{app}\Common downloader.exe"; Description: "{cm:LaunchProgram,Common downloader}"; Flags: nowait postinstall skipifsilent [Registry]Root: HKLM; Subkey: "Software\XXX"; Flags: createvalueifdoesntexistRoot: HKLM; Subkey: "Software\XXX\Common downloader"; Flags: uninsdeletekeyifemptyRoot: HKLM; Subkey: "Software\XXX\Common downloader"; ValueType: string; ValueName: "Path"; ValueData: "{app}"Root: HKLM; Subkey: "Software\XXX\Common downloader"; ValueType: string; ValueName: "Version"; ValueData: "V1.0.0"Root: HKLM; Subkey: "Software\XXX\Common downloader"; ValueType: dword; ValueName: "VersionNum"; ValueData: "100"Root: HKLM; Subkey: "Software\XXX\Common downloader"; ValueType: string; ValueName: "Release Date"; ValueData: "2008/09/29" [Code]function InitializeSetup(): Boolean;var   Version: string;   strPath: string;   ResultCode: Integer;begin   Result:= TRUE;  //read the version  if RegQueryStringValue(HKEY_LOCAL_MACHINE, ‘Software\XXX\Common downloader‘,     ‘Version‘, Version) then  begin    // Successfully read the value    Version := Format(‘Exist the version %s,whether uninstall it?‘,[Version]);    if MsgBox(Version,mbConfirmation,MB_YESNO) = IDYES then    begin     //read the path     if RegQueryStringValue(HKEY_LOCAL_MACHINE, ‘Software\XXX\Common downloader‘,     ‘Path‘, strPath) then        begin         // Successfully read the value         strPath:= strPath + ‘\unins000.exe‘;         Exec(ExpandConstant(strPath), ‘‘‘‘, SW_SHOW,              ewWaitUntilTerminated, ResultCode);        end;    end else    Result:= FALSE;  end;end;


這個例子可以在安裝之前卸載以前的版本,並提示你卸載之前的版本資訊。

Inno Setup 指令碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.