LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying the results from system exec.vi batch file in real time

Hi,
  I'm using system exec.vi to run a batch file that runs rsync (a file transfer program similar to ftp).  I need to run the rsync call in a batch file so I can set up all the required system variables first.  The problem is that when I run a batch file with system exec, nothing is posted to the dos prompt window and I need to see the progress in real time as the file transfer process can take quite some time.  Below is the batch file:
 
@set PATH=C:\rsync;%PATH%
@set CYGWIN=binmode tty
@set TERM=ansi
@set USERNAME=root
@set HOME=C:\rsync
 
C:\rsync\rsync -vv -e ssh Username@RemoteHost/DataLocation C:\Data

  The important line is the last one.  Does anyone have any ideas how to solve this problem?
Message 1 of 8
(4,388 Views)
How do you call System Exec.vi ?
 
 
Is it like this:
George Zou
0 Kudos
Message 2 of 8
(4,376 Views)

As requested, here are the parameters that I pass in the system exec.

Command Line = "C:\SomeDirectory\rsync_run.bat" in string format (with quotes)

Working Directory = C:\SomeDirectory in path format

Run minimized = true

The rest of the parameters are left as defaults.  Also, in case it is important, I'm on WinXP Labview version 6.1

Thanks again,

Ian

Message 3 of 8
(4,369 Views)
How can you expect to see anything posted to the DOS screen if you set run minimized = true?  If you set this to false, do you see anything on the DOS screen?
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 8
(4,359 Views)

Oh, pardon my typo.  Originally it was set to run minimized = false.  The true flag was me playing around with some settings.

Irregardless, even with minimized = false, I see nothing at all, not even echos

Message 5 of 8
(4,357 Views)

Hi Perl,

Have you set "Wait until complete" to false?

Also, you could send the output of the system call to a text file, by adding ">textfilename.txt" to the end of your command.  You then read in the text file within a loop. 

So, if your command is (for example) "runsomething.exe arg1 arg2" then change it to "runsomething.exe arg1 arg2 >textfilename.txt" to redirect any echoed messages to the text file.  You can then open the text file and wire it to a display on the Front Panel to see what is going on.

JLV
Message 6 of 8
(4,348 Views)

Hey thanks JLV,

  I've now got some rudimentary file display working by outputing to file then checking the file.  I do see one possible problem though.  What if I attempt to read from the file at the exact time the batch file is writing to the file?  I can't think of how to simulate this problem, but I imagine labview would freak out.  Any thoughts from anyone?  Thanks for the help guys,

PP

Message 7 of 8
(4,343 Views)

Hi Perl,

I forgot to mention to stop writing to the file and closing it upon completion of the System Exec.

I do open text files while they are being written to using TextPad.   I think LV won't complain if you use the "ReadTextFile.vi", not the open/create one where you have to open, get a file reference and then read it  and closing it...  There is a read text one in the basic file vi's that should do the trick. 

It's been a while since I've done this in LV.  I am currently doing it in CVI and it works well 🙂  

.... so far so good ...

Hope this help,

JLV

Message 8 of 8
(4,325 Views)