Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
1 ratings:
 4 out of 5     Rate this Document

Why Does My Batch File Not Work When Run After My Application Builder Installer?



Primary Software:
Primary Software Version: 8.2.1
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>LabVIEW Full Development System

Problem:
I have an application builder installer that is using the advanced installer property Run executable after Installation to run the batch file. The installer is calling the batch file but it is not behaving correctly. The batch file works fine when I run it, but when the installer runs it, nothing happens. How do I fix this?

Solution:
The batch file is not working correctly because its working directory is not what you expect it to be. When you run the batch file yourself the working directory is the same as the location of the batch file. When the application builder installer runs the batch file, the working directory is the same location as the installer's setup.exe. It does not matter where you have the batch file installed, the working directory will be the location of setup.exe.

If you are trying to launch an application with your batch file, here are two ways to get it working. For both cases the batch file is run using the Run executable after installation installer option. This can be found in your installer's Properties under the Advanced category.

  • Add both the application you need to run and the batch file to your project. In your installer's Properties under the Source Files category, set both files to install to [TempFolder]. The installer will now install both files to where the windows %TEMP% environment variable is pointing. In your batch file call the application using the %TEMP% variable i.e. "%TEMP%\application.exe".

  • Call your application in the batch file without any directory information i.e. "application.exe". Then after your installer is built, place the application you need to run in the same directory as the installer's setup.exe.
Either of these methods will allow your batch file to call an application correctly. If you are distributing your installer on a CD, the first method will install the application to the target machine's hard drive and then run it, while the second method will run the application from the CD.

If you need help getting the installer to run the batch file, see the KnowledgeBases linked below.

Related Links:
KnowledgeBase 149BHCQH: How Do I Make My LabVIEW-built Installer Run an Executable After Installation?
KnowledgeBase 2A6ECPG4: How Can I Include Additional Installers with My LabVIEW Applications' Installer?
KnowledgeBase 2WCDS3DI: Creating a Batch File
KnowledgeBase 33DAKEJ4: Running a Batch File Automatically After an Installation to Access Installed Files

Attachments:





Report Date: 12/27/2007
Last Updated: 01/31/2008
Document ID: 4GQAERN9

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit