05-03-2012 04:52 AM
Hello,
I try to pass command line argument to a labview VI.
Operating System: Windows 7
LabVIEW: 8.2.1
In the past I did it like http://digital.ni.com/public.nsf/allkb/17C3AD70493CE0208625666A00763364
It worked perfectly under Windows XP. Now I changed the Computer to Windows 7. The same program and the same command line argument is not working any more. I tried to debug vi. The command will no longer be detected.
Any ideas?
Thanks a lot.
Best regards,
Michael
Attached: Test.vi with the argument call.
Shortcut to call: "C:\Program Files (x86)\National Instruments\LabVIEW 8.2\LabVIEW.exe" "C:\Users\gum1sh\Desktop\Test.vi" -- 1000 sine
05-03-2012 07:32 AM
I can do this with labview 2010 and W7. Dont have 8.2.1 on this machine so I cant verify that version
04-24-2014 01:01 PM
Passing command line argument problem with LV8.2 Windows7
I have same problem: could not pass paramenters to calling VI.
This is format: "C:\Program Files\....\LabVIEW.exe" "C:\Test.vi" -- 1000 Sine
But it does pass parameter using .exe; Format: "C:\Test.exe" -- 1000 Sine
LabVIEW 8.2 Windows7
04-24-2014 01:09 PM
As far as I know this function is designed for executables built by LabVIEW. Running the LabVIEW exe and then an "unbuilt" VI in the command line might not work.
This makes sense, since you have to change the build specifications to allow arguments to be passed in, the build specifications being for building an EXE.
I don't know if pre-8.x versions of LabVIEW allowed you to pass arguments through an unbuilt VI.
04-24-2014 01:18 PM
Something that I tend to do with applications that I write that need passed-in arguments, I like to have a case statement that reads FP inputs if the VI is being run in development mode, and to read arguments passed in if it's running in EXE mode. That way when I test out my code by running the VI from LabVIEW, I can just type in the FP inputs that I need to run the code, and still have the same code for the EXE as well.
Running in EXE mode, this case runs:
Running in Development Mode, this case runs:
04-24-2014 01:35 PM
LV7.1 allows to pass the argument to .VI and .exe w/o problem. It works in WinXP and Win7 OS.
04-24-2014 02:03 PM - edited 04-24-2014 02:04 PM
Ah, I see that it does say that you can do that in LabVIEW 7.x. It's been a while since I've used 7.x...
Based on the webpage linked in the first post of this thread, I'm not sure if that feature is available beyond 7.x.
I just tried it in 2011 and I can't pass arguments to a VI. The VI opens, but doesn't seem to run. I set the VI to "Run on Open", but then I just got the argument for "LabVIEW" only, and it looks like LabVIEW tries to open the "--1000" and "Sine" as files as well.
I also tried running the CMD as administrator to see if that would help.
No success so far with this; perhaps there's an INI setting for LabVIEW that allows this to work.
02-24-2015 05:45 PM - edited 02-24-2015 05:58 PM
The argument only gets passed if LabVIEW is closed prior to launching it from the command line.
I found that if LabVIEW is already open the trailing user arguments '-- 1000 Sine' are lost.
Edit: I does actually appear to maintain the arguments if the VI that is called has its VI Execution Property 'Run when opened' set to TRUE.