Inno setup 在Inno安装程序中安装任务部分后,如何移动任务部分?

Inno setup 在Inno安装程序中安装任务部分后,如何移动任务部分?,inno-setup,Inno Setup,请注意,我是Inno安装的新手。目前我有以下几点: 安装语言选择1->选择其他任务2->准备安装3->安装4->单击完成退出安装程序。五, 我想要实现的是,在安装4之后,提示用户执行额外的任务2。 我已创建桌面快捷方式,并在其他任务上启动应用程序复选框 下面是我用来生成设置的脚本,其中的各种内容都被模拟数据替换,因为我不能公开它们 #define MyAppName "My App" #define MyAppExeName "MyApp.exe" #de

请注意,我是Inno安装的新手。目前我有以下几点:

安装语言选择1->选择其他任务2->准备安装3->安装4->单击完成退出安装程序。五,

我想要实现的是,在安装4之后,提示用户执行额外的任务2。 我已创建桌面快捷方式,并在其他任务上启动应用程序复选框

下面是我用来生成设置的脚本,其中的各种内容都被模拟数据替换,因为我不能公开它们

#define MyAppName "My App"
#define MyAppExeName "MyApp.exe"
#define MyAppVersion "1.0"
#define MyAppPublisher "MyCompanyName"

[Setup]
AppId={{someId}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={autopf}\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=My App
SetupIconFile=C:\MyApp\logo.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
Name: StartAfterInstall; Description: Launch application; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"

[Files]
Source: "C:\Users\myuser\MyApp\bin\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{userdesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: {app}\{#MyAppExeName}; Flags: shellexec skipifsilent nowait; Tasks: StartAfterInstall
更新:

将我的[跑步]部分更改为:

文件名:{app}\{MyAppExeName};标志:shellexec skipifsilent nowait;后安装:CreateIcon

并添加[代码]部分如下:

[守则] 程序创建图标; 变量 IconFileName:string; 开始 IconFileName:=ExpandConstant'{commondesktop}\DashBoard.lnk'; CreateShellLink IconFileName, ExpandConstant“{app}\{MyAppExeName}”, ,ExpandConstant“{app}”, ExpandContant'{app}\logo.ico',0,SW_SHOWNORMAL; 终止 未在上一个设置步骤中添加复选框

我尝试将ChangesAssociations=yes添加到我的[Setup]部分的末尾,但也没有添加复选框

在那之后,我想我可以使用与在最后一个安装步骤中添加复选框以启动应用程序相同的方法

因此,尝试添加第二个复选框,如下所示:

[Run]
Filename: {app}\{cm:AppName}.exe; Description: {cm:LaunchProgram,cm:AddShortcut,{cm:AppName}}; Flags: nowait postinstall skipifsilent

[CustomMessages]
AppName=MyApp
LaunchProgram=Start MyApp after finishing installation
AddShortcut=Add desktop shortcut
只剩下一个复选框而不是两个

在添加第二个复选框之前,我是否可以这样说:

[Run]
Filename: {app}\{cm:AppName}.exe; Description: {cm:LaunchProgram,{cm:AppName}}; Flags: nowait postinstall skipifsilent

[CustomMessages]
AppName=MyApp
LaunchProgram=Start MyApp after finishing installation
如果需要更多信息,请告诉我

更新:

以下是脚本的最新版本:

#define MyAppName "MyApp"
#define MyAppExeName "MyApp.exe"
#define MyAppVersion "1.0"
#define MyAppPublisher "MyCompany"

[Setup]
AppId={{678F2A68-E028-46F0-A18C-0A47135A98E8}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={autopf}\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=MyApp
SetupIconFile=C:\Users\myuser\Projects\MyApp\logo.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"

[Files]
Source: "C:\Users\myuser\Projects\MyApp\bin\Debug\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{userdesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"

[Run]
Filename: {app}\{cm:AppName}.exe; Description: {cm:LaunchProgram,{cm:AppName}}; Flags: postinstall skipifsilent;
Filename: {app}\{cm:AppName}.exe; Description: {cm:AddShortcut,{cm:AppName}}; Flags: postinstall skipifsilent;

[CustomMessages]
AppName=MyApp
LaunchProgram=Start MyApp after finishing installation
AddShortcut=Add shortcut to desktop

[Code]

procedure CreateIcon;
var
  IconFileName: string;
begin
  IconFileName := ExpandConstant('{commondesktop}\MyApp.lnk');

  CreateShellLink(
    IconFileName, '',
    ExpandConstant('{app}\{#MyAppExeName}'),
    '', ExpandConstant('{app}'),
    ExpandConstant('{app}\logo.ico'), 0, SW_SHOWNORMAL);
end;

希望这有帮助。

在安装完成后选择运行应用程序很容易。见: 或

创建桌面快捷方式更为复杂。从Inno安装脚本的角度来看,一个简单的方法是将快捷方式创建外包给应用程序本身,通过命令行参数或某些脚本(如PowerShell)。然后您可以像上面的应用程序一样运行该应用程序/脚本

如果您希望安装程序自己创建快捷方式,则必须按如下所示对其进行破解:

在代码中创建快捷方式的代码如下: