why the log file not showing exactly displayed in DOS prompt screen while running a batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
goodywp
Posts: 250
Joined: 31 Jul 2017 09:57

why the log file not showing exactly displayed in DOS prompt screen while running a batch file

#1 Post by goodywp » 16 Aug 2017 14:10

I have a question.

When I run a script, I saw DOS showing some error like these

The system cannot find the file specified.
The syntax of the command is incorrect.

But when I check the log file, it did not see any of these errors since I put this run into a log file,

I check some code carefully, did not see any issue...

actually I got the results what I want..

Is this normal? or I should exam all the code?

Thanks

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: why the log file not showing exactly displayed in DOS prompt screen while running a batch file

#2 Post by aGerman » 16 Aug 2017 14:26

There are different streams for normal output and error messages. Depending on what you prefer you can redirect them to different log files or merge them into one log file.
E.g.

Code: Select all

@echo off &setlocal

>"out.log" 2>"err.log" (
  dir "|"
)

>"merged.log" 2>&1 (
  dir "|"
)


Steffen

Post Reply