Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

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.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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

670 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