LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Command Line Arguments to a LabVIEW VI or Executable

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

0 Kudos
Message 1 of 8
(12,037 Views)

I can do this with labview 2010 and W7.  Dont have 8.2.1 on this machine so I cant verify that version

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 8
(12,023 Views)

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

 

 

0 Kudos
Message 3 of 8
(11,361 Views)

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.

0 Kudos
Message 4 of 8
(11,354 Views)

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:

 

Application Arguments Pass.png

 

Running in Development Mode, this case runs:

Application Arguments Pass Case.png

Message 5 of 8
(11,348 Views)

LV7.1 allows to pass the argument to .VI and .exe w/o problem.  It works in WinXP and Win7 OS.

0 Kudos
Message 6 of 8
(11,338 Views)

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.

0 Kudos
Message 7 of 8
(11,325 Views)

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.

Message 8 of 8
(10,569 Views)