Page 1 of 1

Strange output of CLS command

Posted: 07 Mar 2015 14:45
by OperatorGK
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.

Re: Strange output of CLS command

Posted: 07 Mar 2015 15:07
by aGerman
It's a known issue that cls sends a form feed character. See viewtopic.php?p=13680

Regards
aGerman

Re: Strange output of CLS command

Posted: 08 Mar 2015 07:35
by dbenham
One post too early :wink:

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


Dave Benham

Re: Strange output of CLS command

Posted: 24 Apr 2015 13:24
by npocmaka_
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