How Do I Run an Executable or External File from within LabVIEW?Primary Software: LabVIEW Development Systems>>LabVIEW Base Development System Primary Software Version: 1.0 Primary Software Fixed Version: N/A Secondary Software: N/A
Problem: I have an executable (*.exe file) that was created in a different programming environment. This executable runs an application that I would like to call from within my LabVIEW application. How do I launch this executable from within my LabVIEW program? What do I do if the executable requires or can take input options? Solution: The usual method for calling a *.exe file in LabVIEW is to use the System Exec VI. The System Exec VI is located in the Communications palette in LabVIEW 7.x or the Connectivity»Libraries & Executables palette in LabVIEW 8.x and higher. For an example of using the System Exec VI, refer to the Calling System Exec VI in the <LabVIEW>\examples\comm directory in LabVIEW 2012 and lower, or to the Command Line Execution VI in the <LabVIEW>\examples\Connectivity\Libraries and Executables directory in LabVIEW 2013 and higher. Or, refer to the LabVIEW Snippet below for a simple way to run the Windows Calculator program from within LabVIEW (minimum of LabVIEW 8.0 required).Unfortunately, the System Exec VI does not support calling options following the file name. In order to call the executable with options, here is what you can do instead:
My Document.txt. You cannot type My Document.txt into the command line input of the System Exec VI. You can, however, type Notepad My Document, and the System Exec VI will open the text file in Notepad.
![]() Figure 1: Windows Calculator Example
Related Links: NI Community: Launch a File Programmatically in its Default Application KnowledgeBase 2MPCL53N: How Do I Execute a Windows Command in LabVIEW? LabVIEW Help: System Exec VI Attachments:
Report Date: 06/28/1997 Last Updated: 06/30/2015 Document ID: 0YR9TGW1 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

