This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

How to Run an Executable Programmatically in LabVIEW

Updated Apr 5, 2019

Reported In

Software

  • LabVIEW

Issue Details

I have an application or executable (*.exe file) 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.

The System Exec VI accepts a string input to be executed in the Windows Command Prompt. If the executable directory is present in the Windows PATH environment variable, you can run the executable by using its filename as this string input.. (e.g., application_name.exe). Otherwise, you will need to include the full filepath of the executable in the command line input. See Additional Information for examples on how to implement the System Exec VI.
 
The System Exec VI does not support calling options following the file name. If your application requires you to call the executable with options, here is what you can do instead:
  1. Create a filename.bat file which calls the executable file followed by the desired options (e.g. filename.exe -option1 -option2).
  2. Then, use the LabVIEW System Exec VI to call the filename.bat file. Any options indicated in the l;

Additional Information

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. Alternatively, refer to the LabVIEW Snippet below for a simple way to run the Windows Notepad program from within LabVIEW (minimum of LabVIEW 8.0 required).



Figure 1: Windows Notepad Example
 

WAS THIS ARTICLE HELPFUL?

Not Helpful