Harsh Upparwal
Harsh Upparwal

Reputation: 19

How to pass a space and a double quote together in MSI command-line parameters?

I am trying to install a desktop application through the command line. The application comes with an installer package, such as setup.exe, which was created using InstallShield.

I am using this setup.exe to install the application by passing MSI parameters directly to the MSI via the command line. For the reference: setup.exe/s /v"/l*V installer.log INSTALLDIR="""C:\Program Files\Diagnostic manager""" INSTANCE=\"SD-WIN8-02\" REPOSITORY=\"Repository1\" SERVICEUSERNAME=\"SD-WIN8-02\testuser\" SERVICEPASSWORD="/7c2'==V@:~U-L%~*.Rv}CvBV'HHzyAq~'5NGA=" CLUSTERINSTALL=0 SETUPTYPE=Typical ApplicationUsers=AllUsers ALLUSERS=1 /qn"

The SERVICEPASSWORD parameter is expected to have values containing space, double quotes or both. So accordingly these following four scenarios for password must be accepted:

  1. without space and without double quotes (/7c2'==V@:~U-L%~*.Rv}CvBV'HHzyAq~'5NGA=)
  2. without space and with double quotes (/7c2'==V@:~U-L%~*.Rv}CvB"V'HHzyAq~'5NGA=)
  3. with space and without double quotes (/7c2'==V@:~U-L%~*.Rv}CvB V'HHzyAq~'5NGA=)
  4. with space and with double quotes (/7c2'==V@:~U-L%~*.Rv}CvB V'H"HzyAq~'5NGA=)

For these I have tried: The first scenario worked successfully as is: /7c2'==V@:~U-L%~*.Rv}CvBV'HHzyAq~'5NGA=

The second scenario worked after escaping the double quote with a backslash: /7c2'==V@:~U-L%~*.Rv}CvB\"V'HHzyAq~'5NGA=

The third scenario worked when the value was wrapped in escaped double quotes: \"/7c2'==V@:~U-L%~*.Rv}CvB V'HHzyAq~'5NGA=\"

However, combining both adjustments for the fourth scenario (spaces + double quotes) failed: \"/7c2'==V@:~U-L%~*.Rv}CvB V'H\"HzyAq~'5NGA=\"

How can I modify the SERVICEPASSWORD parameter to ensure the space and double quote are passed correctly in this fourth scenario?

I’m looking for a common solution that reliably supports all four scenarios.

Failed Combination for password having space (between B and V) and double quotes (between H and H):

password (space + double quote) INPUT Assumed Reason For Failure
/7c2'==V@:~U-L%~*.Rv}CvB V'H"HzyAq~'5NGA= "/7c2'==V@:~U-L%~*.Rv}CvB V'H\"HzyAq~'5NGA=" space created not handled
/7c2'==V@:~U-L%~*.Rv}CvB V'H"HzyAq~'5NGA= \"/7c2'==V@:~U-L%~*.Rv}CvB V'H"HzyAq~'5NGA=\" double quotes not handled
/7c2'==V@:~U-L%~*.Rv}CvB V'H"HzyAq~'5NGA= \"/7c2'==V@:~U-L%~*.Rv}CvB V'H\\\"HzyAq~'5NGA=\" double quote not handled
/7c2'==V@:~U-L%~*.Rv}CvB V'H"HzyAq~'5NGA= \"/7c2'==V@:~U-L%~*.Rv}CvB V'H""HzyAq~'5NGA=\" double quotes not handled

Upvotes: 0

Views: 67

Answers (0)

Related Questions