LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

system exec.vi question

I'm not able to executes the system command "echo" and dir using the system exec.vi Why?
I'm using labview 6.01 on win2000
0 Kudos
Message 1 of 5
(3,349 Views)
Its easy to confuse the system exec with the dos prompt. The system exec is the equivalent to the "run" line in Windows. I don't remember exactly how to use it, but it involves invoking command.com to execute dos commands.

You can also very easily run batch files in the same manner. Unfortunately, it was in LabVIEW 4 that I last used the system exec to run batch files (coincidently, for the same program for which I wrote the splash screen in another question).

I'm sorry I don't have the exact syntax for calling the command.com to run dos commands. It should be available somewhere.
0 Kudos
Message 2 of 5
(3,349 Views)
system exec.vi runs executable files such as *.exe and *.bat. "echo" and "dir" are not files but commands internal to the command interpreter cmd.exe. Put them in a batch file to execute them.


LabVIEW, C'est LabVIEW

0 Kudos
Message 3 of 5
(3,349 Views)
If you just want to run something, do:

cmd.exe /C

attached is a library containing a vi implementing it. You'll note that I added a few things that make using it a little nicer. First, the code traps the standard error output and puts it into the error cluster. Second, the code strips all the carriage returns from the output. While not absolutely necessary, this tweak makes the output easier to read by removing a bunch of extraneous blank lines. For some reason, a command response contains two carriage returns and a line feed between each line of its output.

Mike...

BTW, the same basic code will work for win95 as well, but the command processor name is different...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 4 of 5
(3,349 Views)
You can find some helpful information if you go to www.ni.com and do a search for:

+"system exec" +dos

The information found in the first webpage in the search results list will be similar to mikeporter's
response

Chris_Mitchell
Product Development Engineer
Certified LabVIEW Architect

0 Kudos
Message 5 of 5
(3,349 Views)