
capturing ouput of a DOS program
Quote:
> I am trying to run PKUNZIP with the -v option to get a list of the
> contents, and capture the list to display in a listbox/textbox.
> When I run the command "pkunzip -v test.zip > test.txt" at the DOS
> prompt, the output is redirected to test.txt and the text file is
> saved.
> When I run the command "pkunzip -v test.zip > test.txt" with WinExec
> the text file is NOT saved.
> Anyone know how to redirect DOS output and get it into Windows?
I responded to this exact question not too long ago. The solution is
described in detail in "Tip 12: Redirecting the Output of a Shelled DOS
Program".
Basically you need to do the following:
1) Programatically write a batch file to the disk that contains the text
"pkunzip -v test.zip > test.txt".
2) Use Shell on the batch file
3) Wait for the process to complete.
4) Read the results.
5) Delete both files.
It works anyway...
Geoff
====================================
"I brake for MCSD's..."
------------------------------------
The Knowledge Base is YOUR FRIEND!!!
http://www.microsoft.com/kb/
====================================