09-06-2022 04:15 AM
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?
Solved! Go to Solution.
09-06-2022 08:49 AM
Check the help of the Advanced settings:
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. |
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.
09-07-2022 01:47 AM
So I put [INSTALLDIR] as a command line argument and in the .bat file I write "%1/executable"?
09-07-2022 02:07 AM
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.
09-07-2022 03:08 AM - edited 09-07-2022 03:12 AM
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:
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.
09-07-2022 03:29 AM
Figured it out. Had to put [INSTALLDIR] between quotation marks.
09-07-2022 03:34 AM
From the 5th line you only have %1 in quotation marks, the full command must be in quotes, like in row 2-4.