LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Installer - need to install an INI from outside the installer when the installer is run

I am working on software for a product.  For this product, one component has a serial number which is used to locate the device from within the VIs for that component.  An INI file with the serial number is used to dynamically load the serial number.  I want to be able to install the INI with the software, so users don't need to manually copy the INI.  Ideally, I'd put a copy of the unique INI with the serial number for a given unit of the product in the folder with the installer, and the installer would see the file and install it while installing the software.  Is there a way to do this without having to rebuild the installer each time we make a new unit of this product?  I've dug through installer options in multiple LabVIEW versions including 2020.  Thanks.

0 Kudos
Message 1 of 8
(1,436 Views)

In the Advanced page there's a "Run executable at end of the installation" option. The "executable" can be a .BAT file that copies the ini file to the required location. A minimal skill about writing a batch file is necessary - especially how to use command line arguments - but it's not complicated.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 8
(1,431 Views)

The other alternative I see would be to make a simple VI that would do the copy and compile that as the EXE to run.  At least it appears that if you use the %programfiles(x86)% environment variable, it automatically goes to the correct folder regardless of language.  I was just hoping there was a cleaner way to do that.  It seems like there should be a way to add lines to setup.ini to do what I need, but unless there's a guide to do that, it's probably easier and faster to make a batch file or simple VI.

0 Kudos
Message 3 of 8
(1,420 Views)

The other trouble I see with the batch file or LabVIEW method, is that if the user selects a custom install folder in the software installer, I don't see a good way of grabbing that so I can install the ini file to the proper location.  I suppose I could either hard-code the application so that it always uses an ini in c:\program files (x86)\... where the "default install path" would be.  Then, I could have the batch/VI install the INI to that location.  This is getting more complicated all the time.

0 Kudos
Message 4 of 8
(1,405 Views)

I have encountered a problem with even calling an exe after install.  The exe must be included in the installer and installed with the product, so then I'm back to the same issue where I'd have to rebuild the installer for each unit of the product.  Any suggestions?

0 Kudos
Message 5 of 8
(1,395 Views)

A normal LabVIEW installer contains a folder with the install.exe file inside it. Put the .ini file in that folder. When your post-build exe runs, have it look in its own directory for an ini file and copy it to the relevant location.

 

I'd also suggest putting your ini file in the AppData folder (use the Get System Directory VI to find that location automatically). You will run into permissions errors, so in your installer, add a destination in that folder and check "Unlock" so Windows doesn't complain.

 

I'd actually recommend adding your whole ini file (minus the specific serial number) inside the installer, then it'll copy over (and unlock) that new directory as part of the installation process. After it runs, your exe can look in the ini file in your installer folder and then just edit the ini file inserted by the installer.

0 Kudos
Message 6 of 8
(1,368 Views)

The only way I can have an exe run post-install is to have it install into the folder with my software.  It doesn't appear to run from the folder with the installer, but from within the folder with my software, which seems to negate what I need.  Unless there's some way to know exactly where my installer folder is, I am not sure how to get my post-install EXE to find the ini in the folder with the installer.

0 Kudos
Message 7 of 8
(1,342 Views)

 


@JPowell  ha scritto:

The only way I can have an exe run post-install is to have it install into the folder with my software.  It doesn't appear to run from the folder with the installer, but from within the folder with my software, which seems to negate what I need.  Unless there's some way to know exactly where my installer folder is, I am not sure how to get my post-install EXE to find the ini in the folder with the installer.



You can pass this information to your executable as a command line argument, using this variable (see more in the LV help):

    • [DISTROOT]

      Full directory path containing the setup.exe file that launched this installer.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 8 of 8
(1,339 Views)