LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running multiple .exe after installer using .bat file

Solved!
Go to solution

Hi there,

 

I created a batch file that should run executables sequentially. The problem is that the batch file is run in the wrong directory. It should be run in 'ProgramFilesFolder\COLLIN\installers.bat', but instead it is run in the installer directory. I could use "cd 'C:\Program Files (x86)\COLLIN\installers.bat'" but that would mean you can only install it in the default folder. Is it possible to include the executable files to the installer or is there another solution?

Ongelofeloos_0-1662454993619.png

Ongelofeloos_1-1662455370721.png

 

0 Kudos
Message 1 of 7
(3,456 Views)
Solution
Accepted by topic author Ongelofeloos

Check the help of the Advanced settings:

    • Command line arguments—Specifies the arguments to send to the application you want to run after the installation is complete. For each argument that represents a path, enclose the argument with quotation marks because paths can contain spaces. In addition to specifying standard arguments, you can embed any of the following variables in the Command line arguments field.
      Command-Line Argument Description
      [INSTALLDIR] Application installation directory that the user selects.
      [DISTROOT] Full directory path containing the setup.exe file that launched this installer.
      If any of these strings are present at installation, the installer replaces them with the correct values before it sends the arguments to the application

I guess that [INSTALLDIR] is what you are searching for. You can use the passed parameter in the bat or cmd file specifying "%1" in a command text.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 2 of 7
(3,425 Views)

So I put [INSTALLDIR] as a command line argument and in the .bat file I write "%1/executable"? 

0 Kudos
Message 3 of 7
(3,398 Views)

I would use "%1executable_name", since [INSTALLDIR] includes the trailing separator according to the help.

For a test, put

pause

as the last cmd line. The command prompt window will not close, waiting for you to press a key. This will allow you to check what's the final command.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 4 of 7
(3,395 Views)

When my batch file looks like this:

@echo on
cd /d "%1"
"%1Newport.XPS.CommandInterface_x86.exe"
"%1Newport.XPS.CommandInterface_x64.exe"
"%1uEye_49610.exe"
"%1"Newport.XPS.CommandInterface_x86.exe
"%1"Newport.XPS.CommandInterface_x64.exe
"%1"uEye_49610.exe
Newport.XPS.CommandInterface_x86.exe
Newport.XPS.CommandInterface_x64.exe
uEye_49610.exe
pause

 

I get the following result:

Ongelofeloos_0-1662538085835.png

 

It does not seem like it wants to switch drives or directories. Also %1 doesn't pass on the full path. It cuts when the first space appears.

 

0 Kudos
Message 5 of 7
(3,387 Views)

Figured it out. Had to put [INSTALLDIR] between quotation marks.

0 Kudos
Message 6 of 7
(3,380 Views)

From the 5th line you only have %1 in quotation marks, the full command must be in quotes, like in row 2-4.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 7
(3,376 Views)