Passing through parameters to a batch file with quotation marks -> ERROR

Having trouble running Advanced Installer? Got a bug to report? Post it all here.
Post Reply
Aka
Posts: 1
Joined: Mon Sep 18, 2017 9:02 am

Passing through parameters to a batch file with quotation marks -> ERROR

Post by Aka » Mon Sep 18, 2017 9:20 am

Hello support,

I'm currently facing a problem while trying to install a tool.

at the end of the installation process I want to execute a batch while which I want to provide with the [APPDIR].

the important part of the batch file:

@ECHO OFF
SET appdir=%~1

The strange thing is, that it is working if I just configure [APPDIR] in the launch file custom action as "command line" parameter.
The installation itself is fine, but certainly the provided appdir was wrong, because of some spaces.

As soon as I add quotation marks and the "command line" value looks "[APPDIR]", the installation fails with a message:
"There is a problem with this Windows installer package. A program runas part of the setup did not finisch as expected. Contact your support personnel or package vendor"

I don't think that the fault is caused by my configuration since it is working without the quoataion marks and if the path does not contain any spaces.

Even a simple echo of the appdir variable fails.
Since the installation itself works without quotation marks I assume that the problem is not caused by the script or so. Running it through the cmd.exe works fine.

Hope you can help me.

Sorin
Posts: 663
Joined: Mon May 08, 2017 1:03 pm

Re: Passing through parameters to a batch file with quotation marks -> ERROR

Post by Sorin » Tue Sep 19, 2017 9:38 am

Hello and welcome to our Forums,

This behavior is triggered by an issue with our "Run as administrator" option for "Launch file" custom action. Please uncheck this option and try to run your launch file custom action with "Run under the LocalSystem account with full privileges (no impersonation)" option. Please note that this option is not available on "Immediately" execution time. If you need your custom action to run on "Immediately" you could try to enable "Run as administrator" option from "Install Parameters" page.

Let me know if this was helpful.

Best regards,
Sorin
Sorin Stefan - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

ruck64
Posts: 30
Joined: Wed Jul 24, 2019 8:46 pm

Re: Passing through parameters to a batch file with quotation marks -> ERROR

Post by ruck64 » Tue Aug 13, 2019 11:58 pm

This was my issue earlier so I unchecked it. It worked for a while. However, its not doing the same thing.

And the box is still unchecked. Any tips?

Eusebiu
Posts: 4629
Joined: Wed Nov 14, 2012 2:04 pm

Re: Passing through parameters to a batch file with quotation marks -> ERROR

Post by Eusebiu » Wed Aug 14, 2019 11:38 am

Hi,

Are you sure that you did not make other changes to your custom action that can cause the error? Does the BAT file work outside Advanced Installer with a similar command line? Does the error appear on multiple machines? Can you send us a verbose log of the installation?

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

ruck64
Posts: 30
Joined: Wed Jul 24, 2019 8:46 pm

Re: Passing through parameters to a batch file with quotation marks -> ERROR

Post by ruck64 » Thu Aug 15, 2019 3:20 pm

I emailed you the documents. I was able to get it working. Though I had to change it to wait for the system to complete the changes

Eusebiu
Posts: 4629
Joined: Wed Nov 14, 2012 2:04 pm

Re: Passing through parameters to a batch file with quotation marks -> ERROR

Post by Eusebiu » Fri Aug 16, 2019 11:53 am

Hi,

I'm glad you got this working.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Post Reply