Catching stderr from VB when using Shell

Posted on 1999-06-23
Medium Priority
Last Modified: 2010-05-18
How do I catch stderr when I am using VB's Shell command? At present I am calling a batch file and redirecting the stdout (standard output) to a text file. Unfortunately this does not catch the stderr (standard error) messages which I also need. Thanks in advance.
Question by:Kitsune

Expert Comment

ID: 1519366

 ' aha will return that c:\xyz.bat does not exist... ?

Is that what you want?

Accepted Solution

simonsabin earned 200 total points
ID: 1519367
Have a look at
for help on dos redirection
if you do

shell ("program 2>c:\err.log")
and then check err.log you will find the stderr output

Author Comment

ID: 1519368
Yes, although I was using the redirection character '>' I was unaware that I could specify the stream value directly prior to it. As a result only stream 1 was being passed to the file when I really required both stream 1 & 2. Also the append option was useful.


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question