How to Read Command Line Parameter in Installshield Script

How to Read Command Line Parameter in Installshield Script

Suppose I run my installer like this:

setup.exe /v"PARAMETER=Value"

How can I read PARAMETER? The documentation proposes to use GetProfString and GetProfInt, but which folder should I use?

2 Answers

For me the folders for setup.ini were I thought parameters would go are as follows:

  • ENGINECOMMONDIR

  • ENGINEDIR

    C:\Users\user_name\AppData\Local\Temp\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
    
  • SRCDIR

    C:\Users\user_name\AppData\Local\Temp\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\Disk1
    

But instead one needs to use system string variable CMDLINE.

Your reference to CMDLINE suggests you are using an InstallScript or InstallScript MSI project, which is populated through the /z notation to its setup.exe.

The /v"PARAMETER=Value" notation applies to the setup.exe used for Windows Installer projects, passing PARAMETER=Value to Windows Installer, which in turns sets the Windows Installer property PARAMETER to Value. The way to read it depends on the context in which you need it, but typically involves either a formatted text field including a reference to the property (e.g. [PARAMETER]), or code that retrieves a property through e.g. MsiGetProperty(hInstall, L"PARAMETER", buf, bufsize) (C++) or Session.Property("PARAMETER") (VB).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Marcus Vance
Author

Marcus Vance

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.