joefio
Posts: 23
Joined: Thu Apr 20, 2023 2:14 pm

Pass installer file location as command line argument

I need to get the installer's directory location when it runs and pass it to my config program that gets called at the end of the install. Using NSIS, I could pass the value of GetExePath. How can I get the installer's directory location and pass it as a command line argument?

I am calling my config program using Launch Installed File custom action and am trying to pass the path as an argument in the command line field.

I can use [AI_SETUPEXEPATH] as an argument which passes the full path \\Folder\setup.exe but I only want to pass the directory it is in \\Folder.
Liviu
Posts: 1042
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Pass installer file location as command line argument

Hello,

If the package type is of EXE, you can use the SETUPEXEDIR to refer to the location where the EXE is located.
setupexedir.png
setupexedir.png (225.38 KiB) Viewed 4989 times

If the package type is an MSI, you can use the OriginalDatabase property:

Hope this helps!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
joefio
Posts: 23
Joined: Thu Apr 20, 2023 2:14 pm

Re: Pass installer file location as command line argument

Liviu wrote: Mon Apr 24, 2023 8:08 am Hello,

If the package type is of EXE, you can use the SETUPEXEDIR to refer to the location where the EXE is located.

setupexedir.png


If the package type is an MSI, you can use the OriginalDatabase property:

Hope this helps!

Best regards,
Liviu
Thank you this will work. Is there any way to get the path name without the trailing slashes? SETUPEXEDIR returns \\Folder\Test\ but I would like to return \\Folder\Test . I could simply trim the trailing slash from within the config program but am curious if there is a way to do this in advanced installer?
Catalin
Posts: 6582
Joined: Wed Jun 13, 2018 7:49 am

Re: Pass installer file location as command line argument

Hello Joe,

Unfortunately, I'm afraid that is not possible as some paths end automatically with that "\".

However, you could have a script custom action that trims that and removes the trailing slash.

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

Return to “Building Installers”