如何编写也允许从CD运行软件的安装程序

时间:2013-11-28 20:06:32

标签: installation inno-setup

我有一个应用程序将位于CD-ROM上,我需要为它制作一个安装程序,它将询问用户是否要从CD-ROM运行应用程序或将其安装在硬盘驱动器上,我怎么能用InnoSetup来做,甚至可能吗?

2 个答案:

答案 0 :(得分:1)

以下是使用[任务]定义CD-ROM或硬盘安装的示例。程序文件位于安装程序附近,即CD-ROM上。您可以通过Startmenu快捷方式启动应用程序,该快捷方式指向CD-Rom或硬盘驱动器,具体取决于所选的任务选项。希望这会有所帮助。

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:Inno Setup Examples Output

[Files]
;The MyProg.exe file shall reside in the same (cd-rom) folder as the Installer. It will only be installed if the Task option RunFromInstallation is checked.
Source: "{src}\MyProg.exe"; DestDir: "{app}"; Flags: external; Tasks: RunFromInstallation;

[Icons]
;Depending upon which Task Option was selected the Start menu item points to either the installation folder or the installation (cd-rom) media 
Name: "{group}\My Program"; Filename: "{src}\MyProg.exe"; Tasks: RunFromExternalMedia;
Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"; Tasks: RunFromInstallation;

[Tasks]
;In Task dialog user will be prompted to select the Deployment Method. Because of the Exclusive Flag only one of the options can be selected.
Name: RunFromExternalMedia; Description: "Run from: {src}";    GroupDescription: Deployment method:; Flags: exclusive;
Name: RunFromInstallation;  Description: "Install to: {app}";  GroupDescription: Deployment method:; Flags: exclusive;

答案 1 :(得分:0)

您可以编写自己的程序询问用户,然后根据需要运行InnoSetup安装程序。

或者,如果需要,请挂钩InitializeSetup event并中止安装程序。