01-21-2014 07:53 AM
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:
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.
Solved! Go to Solution.
01-21-2014 08:44 AM
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 !
01-21-2014 08:52 AM
@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:
01-21-2014 09:05 AM
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.
01-21-2014 09:24 AM
@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.
01-21-2014 09:37 AM - edited 01-21-2014 09:40 AM
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 ?
01-21-2014 09:42 AM
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.
01-21-2014 09:50 AM - edited 01-21-2014 09:52 AM
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!
01-21-2014 09:58 AM - edited 01-21-2014 09:58 AM
Yep ... it should be easy. I sense your frustration.
Just tried the same example with LV 2012 running under Windows 7.
Same result. Fine.
EDIT: Just seen your edit. Good news !!