You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何创建默认选disponly且不可改组件的独立Inno Setup安装程序

Solution: Create a Standalone DispInstall.exe for Display-Only Installation

You’ve got a couple of clean, reliable ways to build a dedicated DispInstall.exe that behaves exactly like running FullInstall.exe with the disponly type selected—while locking users out of modifying type or component choices. Here are the most practical approaches:

1. Compile a Dedicated Installation Script (Simplest Method)

Duplicate your original Inno Setup script (e.g., rename it DispInstall.iss) and tweak it to enforce the display-only configuration, hiding all unnecessary UI elements:

Modified DispInstall.iss Key Sections:

[Setup]
; Set default type to disponly and hide selection UI
DefaultType=disponly
DisableTypesPage=yes
ComponentsPage=no
; Optional: Disable other pages for a streamlined flow (adjust as needed)
; DisableDirPage=yes
; DisableProgramGroupPage=yes

[Types]
; Keep only the disponly type, mark it as fixed so users can't alter it
Name: disponly; Description: Display utility only; Flags: fixed

[Components]
; Restrict components to only those required for disponly
Name: core; Description: Core files; Types: disponly; Flags: fixed
Name: display; Description: Display utility; Types: disponly
; Remove or comment out unused components
; Name: exec; ...
; Name: exec\debug; ...

Compile this script with the Inno Setup Compiler, and you’ll get a standalone DispInstall.exe that directly installs core + display components without any user-facing type/component choices.

2. Use Inno Setup Preprocessor to Build Both Installers From One Script

If you want to maintain a single source script for both FullInstall.exe and DispInstall.exe, use Inno’s built-in preprocessor to conditionally toggle configurations:

Updated Original Script With Preprocessor Directives:

; Define a compile-time constant to switch between full and display-only builds
#define DISP_ONLY 0

[Setup]
#if DISP_ONLY
DefaultType=disponly
DisableTypesPage=yes
ComponentsPage=no
#endif
; Keep your existing [Setup] settings here

[Types]
Name: standard; Description: Standard installation; #if DISP_ONLY Flags: hidden #endif
Name: dev; Description: Development installation; #if DISP_ONLY Flags: hidden #endif
Name: disponly; Description: Display utility only; #if DISP_ONLY Flags: fixed #endif
Name: custom; Description: Custom installation; Flags: iscustom; #if DISP_ONLY Flags: hidden #endif

[Components]
Name: core; Description: Core files; Types: standard dev disponly custom; Flags: fixed
Name: exec; Description: Executive; Types: standard dev custom; #if DISP_ONLY Flags: hidden #endif
Name: exec\debug; Description: Debugger; Types: dev custom; #if DISP_ONLY Flags: hidden #endif
Name: display; Description: Display utility; Types: dev disponly custom

Compile Both Installers via Command Line:

  • Build FullInstall.exe (default full version):
    ISCC.exe YourOriginalScript.iss
    
  • Build DispInstall.exe (display-only version):
    ISCC.exe /DDISP_ONLY=1 YourOriginalScript.iss /O"OutputDirectory" /F"DispInstall"
    

This approach keeps your codebase DRY and lets you generate both installers from a single source.

Why This Beats the Batch File Method

  • No dependency on FullInstall.exe being in the same directory
  • Users can’t bypass the display-only configuration (UI for type/component selection is hidden or locked)
  • The standalone executable feels more polished for end users

内容的提问来源于stack exchange,提问作者Tevildo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:55:58