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).

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

2. Enter product details

"" /edit "C:\MyProject\Sample.aip" /SetProperty ProductName="Tutorial Application"
"" /edit "C:\MyProject\Sample.aip" /SetVersion 1.0.0
"" /edit "C:\MyProject\Sample.aip" /SetProperty Manufacturer="Company Name"
"" /edit "C:\MyProject\Sample.aip" /SetProperty ARPURLINFOABOUT=""
"" /edit "C:\MyProject\Sample.aip" /SetProperty ARPURLUPDATEINFO=""
"" /edit "C:\MyProject\Sample.aip" /SetProperty ARPHELPLINK=""
"" /edit "C:\MyProject\Sample.aip" /SetProperty ARPHELPTELEPHONE="+1 111-222-4444"
"" /edit "C:\MyProject\Sample.aip" /SetProperty ARPCONTACT=""
"" /edit "C:\MyProject\Sample.aip" /SetProperty ARPCOMMENTS="My Comments"

3. Set install parameters

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

4. Add files and folders to your project

"" /edit "C:\MyProject\Sample.aip" /AddFile APPDIR C:\Windows\notepad.exe
"" /edit "C:\MyProject\Sample.aip" /NewFeature Samples
"" /edit "C:\MyProject\Sample.aip" /SetCurrentFeature Samples
"" /edit "C:\MyProject\Sample.aip" /AddFile APPDIR C:\foo.edi
"" /edit "C:\MyProject\Sample.aip" /SetCurrentFeature MainFeature
"" /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

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

6. Add Prerequisites

"" /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

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

8. Add environment variables to your project

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

9. Add merge modules to your project

"" /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

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