LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use System exec.vi

I want to run other command such as "dir c:\" in Lv6.0 (Win2000) and got the
results. I tried System exec.vi , but got error code 2. I am not clear if it
is possible and how to connect the wires to this vi. Maybe I am confused
with the "command line" and "standard input".
0 Kudos
Message 1 of 6
(5,192 Views)
As long as i know, Sistem Exec is only to execute programs, so it can't provide any info except a file. To have directory info, you can use List directory in File I/O>>Advanced menu.
Hope this helps
0 Kudos
Message 2 of 6
(5,190 Views)
Thanks. But actually I want to know how to connect to "command line" and
"standard input", is there any difference between them? And I found that in
Win98, this Vi only has one input.
0 Kudos
Message 3 of 6
(5,190 Views)
Use the "Command Line" input for the entire command as you would type it at the DOS prompt, including all parameters. In this case "dir c:\". The "standard input" allows you to redirect input to the program that you are running. For example if you were running a batch file with a "pause" statement, you could input an end of line through the "standard input" to simulate pressing "Enter" on the keyboard.

You can also wire to the "Standard Output" to get the output from the program to go somewhere other than the screen.

I do not know about Win2000, but in NT, we could not use System Exec.vi to do what we needed and downloaded LVWUtil32 from the site here. This gives you some similar type of capability and more documentation on using it.

Rob
0 Kudos
Message 4 of 6
(5,190 Views)
It seems that is not working properly for dos commands, but it is good for calling executables. Anyway, if you intend to do something more than a dos command I suggest to use Qbasic (>4.0) to create short standalone executables to do the job (at least for Windows 9x).
0 Kudos
Message 5 of 6
(5,190 Views)
Hi Shuliang,

Pass the following command via the Command Line input of sys exec.

"dir c:\ >c:\My_Folder/MY_File.txt"

without the quotes.

the ">" will re-direct the output to the named file.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 6
(5,190 Views)