LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Run a cmd command in LabVIEW with parameters

I have an executable program, for example myprogram.exe, located in "C:\Documents and Settings\myname\myprogram.exe" (I use windows xp 32 bit)

 

When I run the program (by running cmd and type "myprogram.exe > to_text.txt" on the command line), the program will print out the result to that text file.

 

But when I try to run the whole thing on LabVIEW, I can't manage to do so. LabVIEW only supports using the "Run Command" of Windows, not the cmd. (using the SystemExec vi)

 

So how can I run "myprogram.txt > to_text.txt" on LabVIEW as I run it in cmd? Moreover, how can I send the break event (by pressing Ctrl+C in the cmd) by LabVIEW to stop the program?

 

With my appreciations!

0 Kudos
Message 1 of 4
(13,350 Views)
0 Kudos
Message 2 of 4
(13,325 Views)

Often the solution is to initially call the command line interpreter with a subsequent call to the actual program.

So a call to "cmd /C C:\Path\Prog.exe /switch > redirection.log" could help.

For more information on cmd type in a command line window "cmd /?".

Greets, Dave
0 Kudos
Message 3 of 4
(13,305 Views)

I made this a while ago and haven't tested it too much but it should do what you want.  Provide the application path, then the switches in the array.  It does work with built in commands like dir and copy.

0 Kudos
Message 4 of 4
(13,284 Views)