From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Pass Arguments to a LabVIEW-built Executable

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

Description

Overview

This examples shows how to call a LabVIEW-built executable from the command line, also passing user-defined arguments to the executable.

 

Description

It is possible to call any executable from the command line using LabVIEW System Exec.vi and pass user-defined arguments. Using Application>>Command Line Arguments Property Node you can read the value of the arguments passed to the executable when called from the command line.

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1.  Extract attached zip file and open Pass Arguments to Executable LV 2012 NI Verified.lvprj
  2. Open My Application Build Specification
  3. In Information category, set Target filename and Destination directory as desired
  4. In Source Files category, notice that VI to be built into Executable LV 2012 NI Verified.vi has been set as Startup VI
  5. In Advanced category, notice that "Pass all command line arguments to application" has been checked
  6. Build the application
  7. Open Call Executable LV 2012 NI Verified.vi
  8. Set Executable path control to the path of the executable you have just built
  9. Set Argument to Pass to any value and press Send button
  10. The executable will open and display whatever string you typed in the Argument to Pass control in the Command Line Arguments Indicator of the executable.

 

Additional Information or References

Caller VI Block DiagramCall Executable LV 2012 NI Verified.png

 

Distributing Applications with the LabVIEW Application Builder

How to Pass Command Line Arguments to a LabVIEW executable

 

**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.

Comments
Elio_Lüthi
Member
Member
on

When creating the executable, remember to Check the Pass all command line arguments to application box in the Advanced category

kkpp
Member
Member
on

This method works for me to send command to dediware command line application using SYST EXE in LabVIEW.