追加我的" AppName"使用" DefaultDirName"在Inno安装

时间:2018-06-01 10:04:09

标签: inno-setup

我试图用AppName追加DefaultDirName

喜欢

AppName=MyInstaller
DefaultDirName={localappdata}\{#AppName}

路径如下:C:\Users\admin\AppData\Local\MyInstaller

[Setup]
UsePreviousAppDir=no
AppName=MyInstaller
AppVersion=1.5                    
DefaultDirName={localappdata}\{#AppName}
DefaultGroupName=MyInstaller
UninstallDisplayIcon={app}\MyInstaller.exe

我无法使用DefaultDirName附加应用名称。

请有人帮助我,如何追加它?

2 个答案:

答案 0 :(得分:2)

这是InnoSetup向导创建的基本安装程序文件。它使用AppName的常量并将其追加到DefaultDirName。这是使用InnoSetup 5.5.9(u)

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

#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"

[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={{FCC9E92F-AE28-4067-8E23-596A4AB90705}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes

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

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

[Files]
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

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

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

答案 1 :(得分:0)

我使用SetupSetting预处理器函数来扩展[Setup]段指令值。

AppName=MyInstaller
DefaultDirName={localappdata}\{#SetupSetting("AppName")}