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!

adamdc78
Posts: 76
Joined: Wed Mar 19, 2014 7:42 pm

Custom Action > Launch File: .bat with command line arg

I'm attempting to generate a keystore with a password based on property from one of my installation dialogs and having trouble getting it to run during my setup.

The batch file is:

Code: Select all

keytool -genkey -keyalg RSA -alias tomcat -storepass %1 -validity 360 -keystore "%~dp0../.keystore" -keysize 2048 < "%~dp0../cert.txt"
My issue is in passing the argument. When I had a static password, the "Launch File" custom action worked perfectly. When I try to change the "Command Line:" from

Code: Select all

"[#keystore.bat]"
to

Code: Select all

"[#keystore.bat]" [KEYSTORE_PASSWORD]
I get errors.

The script needs to run before the tomcat service is started (or I need to restart the tomcat service later on) and after a custom action which populates "cert.txt" in the first code block (again with values from installation dialogs). I currently have it in Install Execution Stage after Add Resources. I have it running as deferred with no impersonation.

If I leave the modal error box up during my install and run the script from an elevated command prompt in the installation path then it works fine (I moved it right after Finish Execution and restarted my tomcat server manually to test this).

Any suggestions would be most appreciated,

- Adam
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Custom Action > Launch File: .bat with command line arg

Hello Adam,

Can you please configure your "Launch File" custom action like this:
  • File To Launch: [#keystore.bat]
    Command Line: "[KEYSTORE_PASSWORD]"
and try again? If this doesn't help you, can you please send us the .aip (project file) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
adamdc78
Posts: 76
Joined: Wed Mar 19, 2014 7:42 pm

Re: Custom Action > Launch File: .bat with command line arg

Thank you Daniel,

This solved my issue.

This is how I would have thought to do it intuitively, were it not for the documentation telling me that I had to specify the complete path to the file in the command line (see http://www.advancedinstaller.com/user-g ... -file.html) :
The Command Line field should contain the full path of the file you want to launch.
I'm guessing this just needs to be updated to reflect UI changes.

Cheers,

- Adam
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Custom Action > Launch File: .bat with command line arg

You're welcome Adam. I'm glad you sorted this out.

Indeed, the related article has some outdated info. We will update this in a future version of Advanced Installer. Thank you for bringing this to our attention.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”