Create a package using the CLI

ImportantThe following article uses options that are available starting with the Professional edition and project type.

This article replaces most of the Professional Tutorial's GUI settings with their CLI equivalent. Steps from the tutorial are converted into the command line options which perform the same changes or operations in the installer project.

1. Create Project

NoteThe command lines need to be executed in the installation folder of advinst.exe, located in Program Files (x86).

"AdvancedInstaller.com" /newproject "C:\MyProject\Sample.aip" -type "professional" -lang "en" -overwrite

2. Enter product details

"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /SetProperty ProductName="Tutorial Application"
"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /SetVersion 1.0.0
"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /SetProperty Manufacturer="Company Name"
"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /SetProperty ARPURLINFOABOUT="www.example.com"
"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /SetProperty ARPURLUPDATEINFO="www.example.com/download.html"
"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /SetProperty ARPHELPLINK="www.example.com/forums/"
"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /SetProperty ARPHELPTELEPHONE="+1 111-222-4444"
"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /SetProperty ARPCONTACT="support@example.com"
"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /SetProperty ARPCOMMENTS="My Comments"

3. Set install parameters

"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /SetAppdir -buildname DefaultBuild -path [ProgramFilesFolder][Manufacturer]\[ProductName]
"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /SetShortcutdir -buildname DefaultBuild -path [ProgramMenuFolder][ProductName]
"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /SetPackageType x86

4. Add files and folders to your project

"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /AddFile APPDIR C:\Windows\notepad.exe
"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /NewFeature Samples
"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /SetCurrentFeature Samples
"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /AddFile APPDIR C:\foo.edi
"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /SetCurrentFeature MainFeature
"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /NewShortcut -name NOTEPAD -dir SHORTCUTDIR -target APPDIR\notepad.exe -wkdir APPDIR

5. Add registry keys and values to your package

"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /NewReg -RegValue HKUD\Software\[Manufacturer]\[ProductName]\Settings\AppSettings -Data #x36

6. Add Prerequisites

"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /NewPrerequisite "My Application" -type FeatureBased -prereq_path "C:\My Application.exe" -target_os WinNT
          -search_type RegValue -search_path "HKLM\Software\My Application\Version" -minversion 1.0

7. Set package name

"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /SetPackageName MyPackageName

8. Add environment variables to your project

"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /NewEnvironment -name NOTEPAD_PATH -value "[APPDIR]" -install_operation CreateUpdate -behavior Replace

9. Add merge modules to your project

"AdvancedInstaller.com" /edit "C:\MyProject\Sample.aip" /AddMsm  C:\MyMergeModule.msm -feature MainFeature

10. Save project

The project is automatically saved when the "/edit" command is used, so there is no need for a save command. The "Save" command should be used only in an AIC file as explained in the "Executing a file of commands" section from the "Working with Advanced Installer from the Command Line" article.

11. Build project

"AdvancedInstaller.com" /build "C:\MyProject\Sample.aip"