Redirect DIR warnings

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
drgt
Posts: 160
Joined: 21 Sep 2010 02:22
Location: Greece

Redirect DIR warnings

#1 Post by drgt » 01 Nov 2016 06:52

On C:\>Dir /ad /on /s /b >C:\CTree.txt
the file is created BUT a long list of "This directory ... is too long" is output to the screen.

How can I include the screen output in the same file as well
OR
Redirect the screen output to a different file?

Thx

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Redirect DIR warnings

#2 Post by Squashman » 01 Nov 2016 07:19

Assuming it is outputting to Standard Error and not to the console you just add this to the end of your command

Code: Select all

2>&1

drgt
Posts: 160
Joined: 21 Sep 2010 02:22
Location: Greece

Re: Redirect DIR warnings

#3 Post by drgt » 01 Nov 2016 07:35

Yes that put it in the same file.

what about a different file?

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Redirect DIR warnings

#4 Post by penpen » 01 Nov 2016 08:42

Then you should use something like:

Code: Select all

2>"different.file"


penpen

drgt
Posts: 160
Joined: 21 Sep 2010 02:22
Location: Greece

Re: Redirect DIR warnings

#5 Post by drgt » 01 Nov 2016 17:30

Image

Thanks!

Post Reply