LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run labview exe with command line

Solved!
Go to solution

I would like to launch a labview exe with a command line.

I would like to get advice how to launch the Labview exe with giving values to the control parameters?

 

You can view the example where x,y are the controls

 

0 Kudos
Message 1 of 15
(9,667 Views)
Solution
Accepted by topic author Eran1965

There is a much more detailed guide here, which I reference below:

 

1. First you will enable it in the settings:

 

1. Open the properties for the application's build specification

2. Navigate to the Advanced category

3. Check the Pass all command line arguments to application box

 

To pass the command line arguments to the application and access them in your code follow the same steps as for LabVIEW 7.x.

 

2. Then you will use two hypens (--) to pass command line arguments to the VI. 

 

When you launch LabVIEW or a stand-alone executable from the command line, you can pass user-defined arguments to the application. User-defined arguments start after two hyphens (– –) surrounded by spaces in the command line. For example, the following command line entry will launch LabVIEW 7.1 and open test.vi from the root of C:\ and pass 2 arguments, 1000 and sine:

"C:\Program Files\National Instruments\LabVIEW 7.1\LabVIEW.exe" "C:\test.vi" –– 1000 sine

You can also pass a command line argument directly to an EXE without launching LabVIEW, as long as the machine has the appropriate Run-Time Engine and necessary drivers.  For example, if test.vi was built into an executable, it could be called as follows:

"<build directory>\test.exe" –– 1000 sine

 

3. Lastly, you will use a property node to wire them to your controls:


LabVIEW passes the arguments from the command line to the block diagram of the VI or EXE you launch. You can reference the arguments in the block diagram by using the Application:Command Line Arguments selection in a property node, as shown below.

Property Node-Application-Command Line Arguments

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
Message 2 of 15
(9,656 Views)
0 Kudos
Message 3 of 15
(9,486 Views)
0 Kudos
Message 4 of 15
(9,487 Views)

There is also a example demo for this at <LabVIEW>\examples\Application Control\VI Server\Passing Command Line Parameters.vi 


"Should be" isn't "Is" -Jay
Message 5 of 15
(9,621 Views)

Hi

Thanks for your answer

I am following your instruction for my application  (x=10, y=5)   "<build directory>\add.exe" –– 10 5

but I get x = y = 0.

What do you think is wrong?

Thanks...

0 Kudos
Message 6 of 15
(9,606 Views)

You have to do something with the arguments (ie. convert from strings into your numbers).

 

Show us what code you have.  Are you sure you have the executable setup to recieve command line arguments?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 15
(9,598 Views)

Hi

The code is in the attachment of the 1st message.

I add a new attachement with a string (gives the length of the argument string)and it does not work as well ( C:\LabView\builds\str\str.exe  -- aaaa)

 

0 Kudos
Message 8 of 15
(9,585 Views)
You don't have the property node to read the adjustments. Look again at what MrHappyAsthma showed and the example that Jeff mentioned.
Message 9 of 15
(9,578 Views)
Edit - Read the arguments. Sorry
Message 10 of 15
(9,577 Views)