Inno Setup简单使用
1、简介
Inno Setup 是一个免费的安装制作软件,小巧、简便、精美是其最大特点,支持pascal脚本,能快速制作出标准Windows2000风格的安装界面,足以完成一般安装任务。该软件用Delphi写成,其官方网站同时也提供源程序免费下载。
它虽不能与Installshield这类恐龙级的安装制作软件相比,但也当之无愧算是后起之秀。
2、下载
https://jrsoftware.org/ 最新版本是6.2.1
3、安装,搜索网上即可
4、简单使用
脚本
; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "XX" #define MyAppVersion "V1.0" #define MyAppPublisher "XX公司" #define MyAppURL "https://XX.cn/" #define MyApp "Xx" [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={{2504A925-B7D9-4206-9408-0A0365C9818C} AppName={#MyAppName} AppVersion={#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} ;DefaultDirName={pf}\{#MyAppName} ;DefaultDirName={autopf}\{#MyAppName} ;DefaultDirName={pf}\compare DefaultDirName=d:\\compare DefaultGroupName={#MyAppName} OutputBaseFilename=video-client-setup SetupIconFile=D:\deploy\gui\Video.ico Compression=lzma SolidCompression=yes PrivilegesRequired=admin UninstallDisplayName=卸载{#MyAppName} [Languages] Name: "chinesesimp"; MessagesFile: "compiler:Default.isl" [Files] ;拷贝data Source:".\data\*";DestDir:"{app}\data";Flags:igNoreversion recursesubdirs createallsubdirs ;拷贝sqlitedb Source:".\sqlitedb\*";DestDir:"{app}\sqlitedb";Flags:igNoreversion recursesubdirs createallsubdirs ;拷贝sqlite Source:".\sqlite\*";DestDir:"{app}\sqlite";Flags:igNoreversion recursesubdirs createallsubdirs ;拷贝java包 Source:".\java\*";DestDir:"{app}\java";Flags:igNoreversion recursesubdirs createallsubdirs ;拷贝tomcat Source:".\tomcat\*";DestDir:"{app}\tomcat";Flags:igNoreversion recursesubdirs createallsubdirs ;拷贝ffmpeg文件 Source:".\ffmpeg\*";DestDir:"{app}\ffmpeg";Flags:igNoreversion recursesubdirs createallsubdirs ;拷贝脚本文件 Source:".\install_script.vbs";DestDir:"{app}";Flags:igNoreversion recursesubdirs createallsubdirs ;拷贝脚本文件 Source:".\install_video.bat";DestDir:"{app}";Flags:igNoreversion recursesubdirs createallsubdirs ;拷贝脚本文件 Source:".\uninstall_video.bat";DestDir:"{app}";Flags:igNoreversion recursesubdirs createallsubdirs ;拷贝客户端界面文件 Source:".\MainClient\*";DestDir:"{app}\MainClient";Flags:igNoreversion recursesubdirs createallsubdirs [Icons] Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}" Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" Name: "{userdesktop}\{#MyApp}";Filename: "{app}\MainClient\MainClient.exe"; WorkingDir: "{app}\MainClient" [Run] ;修改服务配置文件 Filename:"{app}\install_video.bat";Flags:runhidden;Description:"正在启动或配置相关程序"; [UninstallRun] ;Filename:"{app}\uninstall.bat";Flags:runhidden; Filename:"{app}\uninstall_video.bat";Flags:runhidden; [UninstallDelete] Type:filesandordirs;Name:"{app}\data" Type:filesandordirs;Name:"{app}\sqlite" Type:filesandordirs;Name:"{app}\sqlitedb" Type:filesandordirs;Name:"{app}\ffmpeg" Type:filesandordirs;Name:"{app}\tomcat" Type:filesandordirs;Name:"{app}\java" Type:filesandordirs;Name:"{app}\MainClient" Type:filesandordirs;Name:"{app}\uninstall_video.bat" Type:files;Name:"{app}\InstallUtil.InstallLog"
批处理脚本
install_video.bat
>NUL 隐藏DOS命令显示
@echo off title 软件配置安装中,请不要手动关闭 Rd "%WinDir%\system32\rainss_perm" >NUL 2>NUL Md "%WinDir%\System32\rainss_perm" 2>NUL||(Echo 请使用右键管理员身份运行!&&Pause >nul&&Exit) Rd "%WinDir%\System32\rainss_perm" 2>NUL ::%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit ::如果有以前卸载有残留,导致tomcat服务没有卸载成功,先卸载和删除以前的残留文件 echo ++++++++++++++ 停止运行tomcat服务>NUL net stop CTRVideoClient>NUL echo ++++++++++++++ 卸载tomcat服务>NUL call %~dp0\tomcat\bin\service.bat remove CTRVideoClient>NUL color 0a echo ++++++++++++++ 设置环境变量>NUL set JAVA_HOME=%~dp0\java>NUL set JRE_HOME=%~dp0\java\jre>NUL set PATH=%PATH%;%%JAVA_HOME%%\jre\bin>NUL set CLASSPATH=.;%%JAVA_HOME%%\jre\lib>NUL set CATALINA_BASE=%~dp0\tomcat>NUL set CATALINA_HOME=%~dp0\tomcat>NUL set CATALINA_TMPDIR=%~dp0\tomcat\temp>NUL set SQLITE_HOME=%~dp0\sqlitedb>NUL set PATH=%PATH%;%%SQLITE_HOME%%>NUL echo ++++++++++++++ 环境变量设置完毕>NUL echo ++++++++++++++ tomcat注册服务>NUL call %~dp0\tomcat\bin\service.bat install CTRVideoClient>NUL echo ++++++++++++++ tomcat开机启动>NUL sc config CTRVideoClient start=auto>NUL echo ++++++++++++++ 启动tomcat服务>NUL net start CTRVideoClient>NUL :: echo ++++++++++++++ 浏览器打开系统 http://localhost:8081 :: for /f "tokens=3,4" %%a in ('"reg query HKEY_CLASSES_ROOT\http\shell\open\command"') do (set SoftWareRoot=%%a %%b) ::start http://localhost:8081 exit ::echo 'please input any key to exit...' ::pause>nul
uninstall_video.bat
@echo off title 软件配置安装中,请不要手动关闭 Rd "%WinDir%\system32\rainss_perm" >NUL 2>NUL Md "%WinDir%\System32\rainss_perm" 2>NUL||(Echo 请使用右键管理员身份运行!&&Pause >nul&&Exit) Rd "%WinDir%\System32\rainss_perm" 2>NUL ::%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit color 0a echo ++++++++++++++ 设置环境变量>NUL set JAVA_HOME=%~dp0\java>NUL set JRE_HOME=%~dp0\java\jre>NUL set PATH=%PATH%;%%JAVA_HOME%%\jre\bin>NUL set CLASSPATH=.;%%JAVA_HOME%%\jre\lib>NUL set tomcatpath=%~dp0\tomcat\bin>NUL set CATALINA_BASE=%~dp0\tomcat>NUL set CATALINA_HOME=%~dp0\tomcat>NUL set CATALINA_TMPDIR=%~dp0\tomcat\temp>NUL echo ++++++++++++++ 停止运行tomcat服务>NUL net stop CTRVideoClient>NUL echo ++++++++++++++ 卸载tomcat服务>NUL call %~dp0\tomcat\bin\service.bat remove CTRVideoClient>NUL del %0>NUL exit ::echo 'please input any key to exit...' ::pause>nul