LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Command Line Arguments to VI Without Building EXE

Solved!
Go to solution

I am following this guide: Passing Command Line Arguments to a LabVIEW Executable

 

I want to pass command line arguments in Windows to LabVIEW without building my project into a EXE.  I just want to pass them to a VI which is set to Run When Opened.

 

This is my LabVIEW code:

 

code.png

 

However when I call my VI using the command line, I do not see my user-arguments:

 

"C:\Program Files\National Instruments\LabVIEW 2009\LabVIEW.exe" "C:\Desktop\LabVIEW Code\test.vi" -- test arg1 arg2

 

The above call only yields "LabVIEW" as the first command line arguement.  I don't see "test", "arg1", or "arg2" in the Command Line Arguments array.

 

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
0 Kudos
Message 1 of 9
(4,436 Views)

Hi Happy

 

There's a working example in C:\Program Files\National Instruments\LabVIEW 2010\examples\viserver\cmdline.llb.

Not sure if it's in LV 2009 ?

 

Good luck !

 

Message 2 of 9
(4,400 Views)

@NeilR wrote:

Hi Happy

 

There's a working example in C:\Program Files\National Instruments\LabVIEW 2010\examples\viserver\cmdline.llb.

Not sure if it's in LV 2009 ?

 

Good luck !

 


This example file uses the same approach as above, however it also does not work:

 

"C:\Program Files\National Instruments\LabVIEW 2009\LabVIEW.exe" "C:\Program Files\National Instruments\LabVIEW 2009\examples\viserver\cmdline.llb\CommandLine.vi" -- /number:4.000000

 

Output:

 

Untitled.png

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

Check into the examples for Asynchronous Call By reference.  Essentially you need to open a vi server reference to the vi with the right flags set.  the help on open vi server reference will explain the flags.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 9
(4,383 Views)

@JÞB wrote:

Check into the examples for Asynchronous Call By reference.  Essentially you need to open a vi server reference to the vi with the right flags set.  the help on open vi server reference will explain the flags.


Would you be able to create an example?  I found this: Asynchronously Calling VIs but it seems to only address running a subVI in an asynchronous manner.  It doesn't explain command line arguements passed when the VI first runs.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
0 Kudos
Message 5 of 9
(4,371 Views)
Solution
Accepted by topic author MrHappyAsthma

Hmmm ... that's disappointing. I've just tried it with LV 8.5 and it's fine with that too.

I've been running these under XP SP3.

I assume you completely closed Labview before running the command line ?

 

1.jpg

 

2.jpg

 

 

 

 

 

 

Message 6 of 9
(4,363 Views)

Mr. Happy

I could respond with a volume or a simple example.

 

What do you want to accomplish?  What have you tried?  And, I know the help file can make you gyrate unexpectedly. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 9
(4,360 Views)

I am using Windows 7 and LabVIEW 2009.

 

I do, indeed, close LabVIEW completely before trying to run that example.

 

All I need is a way to execute my VI and pass it some custom parameters using the double hyphen (--).

 

EDIT: 

 

I finally got it to work.  The "closing out completely" did the trick.  For some reason a LabVIEW process was still running in the background...  But I force closed it with Task Manager and now it works!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
0 Kudos
Message 8 of 9
(4,351 Views)

Yep ... it should be easy. I sense your frustration.

Just tried the same example with LV 2012 running under Windows 7.

Same result. Fine. Smiley Frustrated

 

EDIT: Just seen your edit. Good news !!

 

 

Message 9 of 9
(4,339 Views)