Kondal Kolipaka
Posts: 5
Joined: Thu Mar 05, 2015 7:49 am

How to get the installation folder path

While installing a software,in the prerequisite stage I wanted to invoke batch file and that will do the required job and that job has to create certain files dynamically in the user selected installation folder.

so how do i get the user selected installation path and how do i send that to a batch file.

Thank you.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: How to get the installation folder path

Hi and welcome to Advanced Installer forums.

The user selected installation path is stored in the "[APPDIR]" property that you can sent to your BAT file. In your bat file you can use the "%1", "%2" notations that will be replaced with your command line parameters.

So, if you have a BAT file that contains the following code:

Code: Select all

echo %1
and send the [APPDIR] command line to it, it will display the following result:

Code: Select all

C:\Program Files\Your Path\
(the path contained by the APPDIR property).

Let us know if this helped, otherwise give us more details about your scenario.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Kondal Kolipaka
Posts: 5
Joined: Thu Mar 05, 2015 7:49 am

Re: How to get the installation folder path

Hi Eusebiu, Thanks a lot for the reply. That helps.

Just to be more precise.

This is how I configured .bat file in prerequisite screen, I am new to the tool, so not sure is there any other better way do the same thing.
Please find the attached perquisite screenshot.
prerequisite screen
prerequisite screen
screen.png (71.75 KiB) Viewed 8265 times
I just gave this file as a URL (Use files from disk through option)

This is my test.bat file content:

Code: Select all

:: Install the latest version
npm install TInstall --prefix "UserseletedPath here" 
so how do I pass this [APPDIR] property here ?
And other part of the question is, how do I hide this command window execution while installing. Can I do this silently without really showing the command window to the user.

I might be following completely wrong approach, please suggest!
Kondal Kolipaka
Posts: 5
Joined: Thu Mar 05, 2015 7:49 am

Re: How to get the installation folder path

Any suggestions please!
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: How to get the installation folder path

Hi,

Sorry for the delayed reply, but I was not in the office in the last days.

Please keep in mind that in order to execute a BAT file, it is recommended to use the "Custom Actions" support, for instance the "Launch file" predefined custom action and check the "Hide program's window" option to hide it.

If you want to use the "Prerequisites" support, you need to add it as a "Package Prerequisite" not as a "URL Prerequisite", but in this case the CMD window cannot be hidden.

Also, as I mentioned in my previous post, you need to pass that user selected path through command line (in the "Install Command Lines" fields) and use the "%1" notation where you want to use that path in the bat file. For example:
  • Install Command Lines -> Full UI field will contain: /quiet "[APPDIR]"
Then use the following code in your BAT file:

Code: Select all

:: Install the latest version
npm install TInstall --prefix %1
Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Kondal Kolipaka
Posts: 5
Joined: Thu Mar 05, 2015 7:49 am

Re: How to get the installation folder path

Thank you so much. It worked. :D
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: How to get the installation folder path

You're welcome. I'm glad you got this working.

Just let us know anytime you need help.

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

Return to “Common Problems”