Call the DOS command and redirect the output to a file

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

  • call DOS command
  • capture both stderr and stdout to a file during this call

I would like to open this file in Visual Studio after the command completes.

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

Thanks Mark

+3
source share
1 answer

DOS, > 1 > stdout, 2 > stderr. ,

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

myprog.exe 1>2> both.txt

.

VB/VBA Shell, ( ).

+2

Source: https://habr.com/ru/post/1739597/


All Articles