LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview is using stale command line arguments

I've created a vi to test passing command line arguments to Labview. I've attached it below. All it does is display the 1st and 2nd arguments. Also in VI Properties in the Execution category, it's set to 'Run when opened'.

 

In the command prompt I'm entering: "C:\Program Files (x86)\National Instruments\LabVIEW 2014\LabVIEW.exe" "C:\Users\command_line_arguments.vi" -- a b

 

This works - the vi launches, and displays a and b. However, if I run it again from the command prompt with  -- a c  as the arguments, it still displays a b. Only if I exit the vi, and quit LabVIEW (so that LabVIEW.exe stops running) then launch it again from the command line does it display a c.

 

So for some reason Application:Command Line Arguments is using stale data, and ignoring the new arguments. Is this a bug, or am I using it in the wrong way? Thanks.

0 Kudos
Message 1 of 4
(2,795 Views)

lv_manchester wrote:

So for some reason Application:Command Line Arguments is using stale data, and ignoring the new arguments. Is this a bug, or am I using it in the wrong way? Thanks.


That's normal behavior, the command line arguments are always the ones with which LabVIEW was first started. I think most single-instance applications work this way, although it's not something I've ever tested. Attempting to run LabVIEW again will just bring the already-running application to the front.

0 Kudos
Message 2 of 4
(2,784 Views)

Ok thanks. The reason I ask is because I have a python script that is running a Labview vi repeatedly with different arguments each time. Do you think the easiest way for me to solve this is to build the vi into a standalone .exe ?

0 Kudos
Message 3 of 4
(2,780 Views)

That seems like a straightforward solution. If the overhead of re-launching the application on each call is a problem, you could instead build a DLL out of your LabVIEW code. You would then need to pass data to the LabVIEW function as parameters (which might be an advantage, actually) instead of as a string on the command line, but you'd only have to load the DLL once and it would stay in memory.

0 Kudos
Message 4 of 4
(2,768 Views)