Strange output of CLS command

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
OperatorGK
Posts: 66
Joined: 13 Jan 2015 06:55

Strange output of CLS command

#1 Post by OperatorGK » 07 Mar 2015 14:45

Hi! Today I wrote a small batch file called pingStat.bat :

Code: Select all

@echo off
ping google.com -n 8
cls
ping bing.com -n 8

While it runs with no output redirection, it's all OK. But when I tried to log it with

Code: Select all

 pingStat > ping_%date%.log

file output was strange
ping_07.03.2015.log:

Code: Select all

[ping statistics for google]

[ping statistics for bing]

Later I discovered that

Code: Select all

 CLS > file 
or even

Code: Select all

 CLS > con 
produces strange character ♀.
Anybody have an idea why that is happening? I may even try to disassemble cmd.exe.

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

Re: Strange output of CLS command

#2 Post by aGerman » 07 Mar 2015 15:07

It's a known issue that cls sends a form feed character. See viewtopic.php?p=13680

Regards
aGerman

dbenham
Expert
Posts: 2197
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: Strange output of CLS command

#3 Post by dbenham » 08 Mar 2015 07:35

One post too early :wink:

I actually talk about it at the end of my subsequent post


Dave Benham

npocmaka_
Posts: 480
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

Re: Strange output of CLS command

#4 Post by npocmaka_ » 24 Apr 2015 13:24

another way to produce <FF>:

on xp

Code: Select all

break>ff
print /d:ff ff


on (vista?) 7 and above

Code: Select all

del ff /q /f >nul 2>nul
break>e
print /d:ff e
del e  /q /f >nul 2>nul



to print to file in XP you need already existing file.On 7 non-existing - at least my tests say so. idk why is this difference.Also on XP PRINTing appends

Post Reply