Example Code

Using the System Exec VI to Launch Applications from the Command Line

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This example shows how to call a targeted Windows' application (i.e. Calculator) using the System Exec VI.

 

Description

This VI uses a Call Library Function Node along with string and path manipulation VIs to build inputs to the System Exec VI.  This VI allows the user to make command line calls from LabVIEW.  This example includes the ability to launch Windows Volume Control as well as the Windows Calculator.  It could easily be expanded to include other command line applications. 

 

Note: If you are using a Windows 7 machine, the String Constant in the Volume Ctrl case of the Case Structure should be changed from "System32\sndvol32.exe" to "System32\sndvol.exe"

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Select which target application you would like to run using the Target control on the front panel
  2. Click the Run button
  3. Your application will launch

 

Additional Information or References

 

VI Snippet

1.png

 

 

Solution Prepared By,

Ian Fung, Koo

ian_fung@yahoo.com | Singapore

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.