views:

32

answers:

1

I'd like to have a macro in Visual Studio 2005 that calls a DOS command and redirects the output (stdout and stderr) to a file. Just calling the command and ">" redirecting it will not capture stderr, so there are two parts to this:

  1. calling a DOS command
  2. capturing both stderr and stdout to a file during that call

I'd then like to open this file in Visual Studio after the command completes.

I'm new to Visual Studio 2005 macro writing, and VB/VBA, so that's the kind of help that I'm looking for.

Thanks, Mark

A: 

In DOS, > or 1> is stdout, and 2> is stderr. So, you could say

myprog.exe 1> out.txt 2> err.txt

to send them to separate files, or

myprog.exe 1>2> both.txt

to send them to both.

In VB/VBA, you could use the Shell command to call this (assuming you didn't know that already).

JohnK813