We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

jdorninger
Posts: 8
Joined: Mon Mar 31, 2014 11:51 am

Passing Installer Properties to batch file as paramters

Hi,

I am trying to pass installer properties to a batch file as paramters.
Currently the batch is called and only directory paramters are passed along. I am setting some properties in the dialogs, but these cannot be passed to the batch file.

The batch file contains only

Code: Select all

@echo off
echo Parameter 1 %1
echo Parameter 2 %2
echo Parameter 3 %3
echo Parameter 4 %4
echo Parameter ALL %*
pause
This is the configuration
viewer.jpg
viewer.jpg (57.75 KiB) Viewed 7169 times
The result from the batch file:

Code: Select all

Parameter 1 ""
Parameter 2 ""
Parameter 3 "D:\test\test-SetupFiles\"
Parameter 4 "C:\Program Files (x86)\Your Company\Your Application\"
I played around with all kind of settings e.g. deferred, commit, set property without sequence, ... and did not find anything ...

Attached is the prj file
test.aip
prj file
(12.4 KiB) Downloaded 299 times
Can someone point me to the solution.

Br,
Jan
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Passing Installer Properties to batch file as paramters

Hi Jan and welcome to Advanced Installer forums,

This is happening because you are using Private properties which are set during Wizard Dialogs Stage. Please keep in mind that there are two main types of Windows Installer properties:
  • -Private Properties (contain lower-case letters in their name, example: My_Prop)
    -Public Properties (contain only upper-case letters in their name, example: MY_PROP)
The difference between Private and Public Properties consists in the way their values are being passed on. The value of a Public Property is passed on from the Wizard Dialogs Stage (in which the dialogs are showed) to the Install Execution Stage (in which the system is modified).
Therefore, make sure that you use a Public Property for an UI control (Editbox, Combobox etc) if you want its value to be available in the InstallExecute Sequence.

Here's the Windows Installer Properties article which may be useful to you.

Please let us know if that helped otherwise give us more details about your specific scenario (maybe exemplify).

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jdorninger
Posts: 8
Joined: Mon Mar 31, 2014 11:51 am

Re: Passing Installer Properties to batch file as paramters

Hi,
Thanks, the upper case did the trick
Br,
Jan
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Passing Installer Properties to batch file as paramters

You're welcome Jan,

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jdorninger
Posts: 8
Joined: Mon Mar 31, 2014 11:51 am

Re: Passing Installer Properties to batch file as paramters

Hi Dan,
I am back with a slightly different problem.
Now I need to pass variables to the batch file which have spaces, like in my test project which seems fairly easy with quotes.

But in my real project, if I put quotes around the variables the viewer.exe is not executed anymore (I don't see the cmd window) but in the logfile there is

Code: Select all

MSI (s) (78:D8) [21:55:47:363]: Executing op: CustomActionSchedule(Action=viewer.exe_1,ActionType=1090,Source=BinaryData,Target=/RunAsAdmin "C:\Users\Luxor\AppData\Local\Temp\install.bat" "Server" "hhh hhh66",)
The config difference is only the quotes
This works:
works.jpg
works.jpg (8.34 KiB) Viewed 7090 times
This does not work:
dont.jpg
dont.jpg (10.83 KiB) Viewed 7090 times
I hope this is again a simple trick ;)
Br,
Jan
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Passing Installer Properties to batch file as paramters

Hi Jan,

I'm not sure why you encountered this behavior.
In order to have a better view about this, can you please send us the .AIP (project file) and the full verbose log of the installation process to support at advancedinstaller dot com so we can investigate them? If contains confidential information you can send us a small test project which reproduce this behavior.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jdorninger
Posts: 8
Joined: Mon Mar 31, 2014 11:51 am

Re: Passing Installer Properties to batch file as paramters

Hi,
Thank you very much for your answer.
I am not sure what I did but I got it working after playing around with the settings.
It was probably the run as administratior and the execution time of the script.
I removed the run as administrator and changed the install paramters to run as administrator.
This did the trick I think.
Br,
Jan
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Passing Installer Properties to batch file as paramters

You're welcome Jan,

I'm glad you got this working. If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”