Nermendis
Posts: 3
Joined: Mon Apr 01, 2024 8:59 am

Installation route

Hello

I would like to ask for help. I've done a lot of searching on the subject, but I can't find it.
I want to run a bat file that will find the installation path, save it to a registry key. I then set APPDIR to this value from the key.
However, it seems that the scanning of the "registry key" always happens before the bat file is run.

How can I do this? The target location can be in 2 places, so I need to find it before installation.

Thank you! And excuse my English.
files.PNG
files.PNG (12.82 KiB) Viewed 6712 times
search.PNG
search.PNG (12.19 KiB) Viewed 6712 times
LaunchsFIle.PNG
LaunchsFIle.PNG (36.46 KiB) Viewed 6712 times
Image
Image
Catalin
Posts: 6611
Joined: Wed Jun 13, 2018 7:49 am

Re: Installation route

Hello,

Indeed, the search you have configured is executed during the "Search" action group from the Custom Actions page.

What you can do to work this around is doing the search thorugh a custom action and then using the respective command to set the APPDIR property.

How to set an installer property using custom actions

I have to admit that this scenario is quite strange to me. Could you please let me know how that bat file is finding the installation path?

I'm asking because we can perhaps find an easier way to achieve what you ened. :)

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Nermendis
Posts: 3
Joined: Mon Apr 01, 2024 8:59 am

Re: Installation route

The bat file first looks for a mod folder for the program (this may contain translations), if it doesn't find it, it looks for the folder where the program is installed.

Rem @for /f %%i in ('WHERE /R C:\ strings.po') do @set foC=%%i
@for /f %%i in ('WHERE /R D:\ strings.po') do @set foD=%%i
REG ADD "HKCU\Software\installFolder" /v "InstallLocation" /t REG_SZ /d %foD% /f

All around this is what the bat file currently looks like, it now finds 1 route successfully.
Nermendis
Posts: 3
Joined: Mon Apr 01, 2024 8:59 am

Re: Installation route

I also found an earlier article that you cannot return a value with a batch file. On your recommendation, I wrote an inline PowerShell script to give a value to my own property, and it works perfectly! Thanks for your help!
Catalin
Posts: 6611
Joined: Wed Jun 13, 2018 7:49 am

Re: Installation route

Hello,

You are always welcome, glad to hear everything is working as expected.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”