工具 Inno setup 最简单打包代码

环境:Win7 x64

目标:安装程序包,不选择路径,不选择开始菜单文件夹名

代码:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "AppName"
#define MyAppVersion "1.0"
#define MyAppPublisher "Company"
#define MyAppURL "http://www.12345678.com/"


[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={{5FA1FFC3-B175-4E6C-8918-5103B118AB22}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
;DefaultDirName={pf}\{#MyAppName}
;DefaultGroupName={#MyAppName}
;不需要选择路径
CreateAppDir=no
AllowNoIcons=yes
OutputDir=E:
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
;开始菜单中的程序组名称不用指定
DisableProgramGroupPage=yes
DefaultGroupName={#MyAppName}


[Languages]
Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"

[Files]
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}";
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}";   

[Code]
function InitializeSetup(): Boolean;

var 
Env_Path:String;
begin
Env_Path := GetEnv('ENV_PATH')

if Env_Path = '' then
begin
MsgBox('路径不存在,退出安装程序!', mbInformation, MB_OK);
Result :=false
end
else
Result :=true
end;

;必须带参数 Param:String,否则报错
function GetPath(Param: String):String;
var 
  Env_Path:String;
begin
  Env_Path := GetEnv('ENV_PATH')
  Result :=Env_Path
end;

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值