Redirecting output from a SHELLed DOS Box 
Author Message
 Redirecting output from a SHELLed DOS Box

I can't persuade a batch file that runs a 'C' compiler MAKE session to
accept output redirection.

I'm using the command:-

Shell "build >compiler.out", vbNormalFocus

The process works fine but the output isn't redirected. I need to
capture it to blast into my editor for review.

In fact now I try it, I have trouble getting W95 to redirect the
output of all batch files.

Any ideas?
--
Steve
Steve



Sat, 03 Jul 1999 03:00:00 GMT  
 Redirecting output from a SHELLed DOS Box

Hello Steve,

I don't know if this will work, but you might try running the command
processor as well as the program.  I don't think redirection will work with
a program running without a shell.  Try:

Shell "command /c build >compiler.out", vbNormalFocus

for Windows 95 and:

Shell "cmd /c build >compiler.out", vbNormalFocus

for Windows NT.  For Windows 3.1, creating a PIF file for the application
and shelling it instead.  But I assume that you're running either 95 or NT.

If it still doesn't work, it might be because the program that you're
running does support redirection.  In other words, it may not write to
STDOUT, it might write directly to the console or to STDERR (redirect
STDERR with a 2>, I think).  Can you redirect from the command line without
a problem?  If so, than changing the shell statement as I've suggested
should fix your problem.  If you can't redirect manually, then most likely
you're going to have a hard time.  The app just isn't made to support
redirection.

I hope this helps,

Larry Tubbs, MCPS, MCSD
Silverleaf Vacation Club

http://www.flash.net/~enigma/



Quote:
> I can't persuade a batch file that runs a 'C' compiler MAKE session to
> accept output redirection.

> I'm using the command:-

> Shell "build >compiler.out", vbNormalFocus

> The process works fine but the output isn't redirected. I need to
> capture it to blast into my editor for review.

> In fact now I try it, I have trouble getting W95 to redirect the
> output of all batch files.

> Any ideas?
> --
> Steve
> Steve



Sun, 04 Jul 1999 03:00:00 GMT  
 Redirecting output from a SHELLed DOS Box

Thanks for all the E-Mail replies and advice,

I tried Shell "command.com /s build >compiler.out", vbNormalFocus
but without success.

The thing works fine with NT3.51 using:

   Shell environ$("comspec") & " /c build >compiler.out", ...

but not with W95.

I finally cracked it by running Shell "build.bat", ... which contains:

   "command.com /c build >compiler.out"

to invoke an additional secondary batch file with redirection.

This now works on both W95 & NT by creating both batch files from
within the VB program.

Thanks again to all,
--
Steve

Quote:

>I can't persuade a batch file that runs a 'C' compiler MAKE session to
>accept output redirection.
>I'm using the command:-
>Shell "build >compiler.out", vbNormalFocus
>The process works fine but the output isn't redirected. I need to
>capture it to blast into my editor for review.
>In fact now I try it, I have trouble getting W95 to redirect the
>output of all batch files.
>Any ideas?
>--
>Steve



Mon, 05 Jul 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Redirected Output From DOS Shell In Visual Basic 6

2. shell with dos tool output redirected to a file

3. Probs with redirecting output of a shell started DOS-App to a file

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

5. Redirect Dos box output

6. Copy FTP - SHELL DOS BOX OUTPUT TO FILE

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

8. Please help: redirecting output of shell started program

9. redirect output of program run with shell command

10. Redirecting output with Shell

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

12. Redirecting output in a shell (VB5)

 

 
Powered by phpBB® Forum Software