Probs with redirecting output of a shell started DOS-App to a file 
Author Message
 Probs with redirecting output of a shell started DOS-App to a file

Hi out there & please help again....

while developing a small depacker shell, I encounter Probs with redirecting
output of a shell started DOS-App to a file. It seems imposible to get it
done with the following code:
_____________________________________________________
Private Sub btnZipTest_Click()
    Dim RetVal
    Dim i As Integer

    strUnzip = "pkunzip -t " & strArchivName & " >e:\hallo\report.txt"
     RetVal = Shell(strUnzip, 1)    ' Extract Files
    AppActivate RetVal, True

End Sub
_____________________________________________________

The code works so far, opens a shell and tests an archive with pkunzip, but
does not create a file "report.txt" in the chosen directory.
When opening a shell and typing "pkunzip -t test.zip >report.txt", the file
is created - why not while opening the Shell under VB?!

Anyone a better idea on how to get the output of pkunzip to a file, or
better - into a TextBox?

Any help appreciated!



Sun, 14 Oct 2001 03:00:00 GMT  
 Probs with redirecting output of a shell started DOS-App to a file
Michael,

If you want to use redirection of the console output, you
need to shell to the command processor:
      "c:\windows\command.com " or Environ$("comspec")

Or,  try writing a batch file and shelling that.

For the hat trick, if you want to get the <STDOUT> into
a text box then go here:
http://{*filter*}net.pair.com/    and download the "clipboarddos"
utilites. The program "clipcopy" will allow  redirection via pipe to
the clipboard. Then you can use the clipboard.settext method
from VB to fill the textbox.

HTH, Mark

Quote:

>Hi out there & please help again....

>while developing a small depacker shell, I encounter Probs with redirecting
>output of a shell started DOS-App to a file. It seems imposible to get it
>done with the following code:
>_____________________________________________________
>Private Sub btnZipTest_Click()
>    Dim RetVal
>    Dim i As Integer

>    strUnzip = "pkunzip -t " & strArchivName & " >e:\hallo\report.txt"
>     RetVal = Shell(strUnzip, 1)    ' Extract Files
>    AppActivate RetVal, True

>End Sub
>_____________________________________________________

>The code works so far, opens a shell and tests an archive with pkunzip, but
>does not create a file "report.txt" in the chosen directory.
>When opening a shell and typing "pkunzip -t test.zip >report.txt", the file
>is created - why not while opening the Shell under VB?!

>Anyone a better idea on how to get the output of pkunzip to a file, or
>better - into a TextBox?

>Any help appreciated!



Sun, 14 Oct 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. using shell to exec dos app and redirect it's output

2. shell with dos tool output redirected to a file

3. Redirected Output From DOS Shell In Visual Basic 6

4. Redirecting output from a SHELLed DOS Box

5. Please help: redirecting output of shell started program

6. Capture output of shelled DOS APP

7. Capturing DOS app output from the Shell() function

8. How to sent a keystroke to a dos-app started with the shell function in vb6

9. Copy FTP - SHELL DOS BOX OUTPUT TO FILE

10. Redirecting the output of a DOS application to my .NET application

11. VB: How do I redirect (capture) a dos-prompt's output

12. Help - redirect DOS output?

 

 
Powered by phpBB® Forum Software