Running a Batch File Automatically After an Installation to Access Installed Files

Updated Oct 21, 2020

Environment

Hardware

  • PXI Controller

Software

  • LabVIEW Application Builder Module
  • LabVIEW

How do I run a batch file automatically that accesses and modifies files in the install directory?

  1. Add your batch file to a LabVIEW Project by either dragging and dropping or right-clicking on My Computer from within the project and selecting Add » File....
  2. From the project, right-click on Build Specification » New » Installer 
  1. Select the Source Files tab.
  2. Add the batch file to the installer by selecting it under My Computer and clicking the arrow.
  3. Select the Advanced tab
  4. Check Run executable after installation 
  5. In the Executable field enter the name of the batch file you want to run
  6. In the Command line arguments enter [INSTALLDIR]filename, where filename is the name of the file you are trying to access in your batch file. This command line argument will be passed to the batch file as a variable.
  7. In the batch file, use %n as the variable passed from the command line argument, where n is the number of the command line argument you want to reference.

Additional Information

  • The image below shows two command line arguments and the associated batch file that these arguments are passed to.
  • Be sure and include the batch and other files in the installer using the files button on the installer settings tab.
  • The attached files are used to create an installer that replaces the contents of the applications ini file with the contents of the attached text file. In this case the file will enable the web server