echo <FF> (to screen or a file)

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
miskox
Posts: 630
Joined: 28 Jun 2010 03:46

echo <FF> (to screen or a file)

#1 Post by miskox » 22 Jul 2010 07:59

Hi all,

I would like to echo a FORMFEED control code to a screen (or a file).

echo X* causes me problems because NOTEPAD does not like x0C (wants to save a file in Unicode). If I save it as ANSI I get a plus (+) sign.

* replace X with an ALT+12 on the numeric keypad so you get a FORMFEED control code.

Any ideas how to do this so NOTEPAD will like it?

I was thinking of using a temporary file with only a x0C code in it (total file size of 3 bytes = 0C0D0A) and then appending it to the resulting file. But I would like to avoid this option if possible.

Thanks,
Saso

jeb
Expert
Posts: 1055
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

Re: echo <FF> (to screen or a file)

#2 Post by jeb » 22 Jul 2010 09:07

Try it with "Convert decimal to hex, and bytes to chars"
http://www.dostips.com/forum/viewtopic.php?f=3&t=951&p=3305#p3305

jeb

miskox
Posts: 630
Joined: 28 Jun 2010 03:46

Re: echo <FF> (to screen or a file)

#3 Post by miskox » 26 Jul 2010 04:27

Thanks Jeb. I did check that - but I admit - too complex for me. For now there is no solution.
This problem does not have a highest priority at the moment.

Thanks,
Saso

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: echo <FF> (to screen or a file)

#4 Post by !k » 26 Jul 2010 15:25

miskox wrote:For now there is no solution.
WUT

Code: Select all

@echo off
call :create "%temp%\sbs2.com"

rem 0c0d0a 2 file
echo.|"%temp%\sbs2.com" 0 "$0d$0a" "$0c$0d$0a" >0c0d0a.txt
rem 0c0d0a 2 scr
echo.|"%temp%\sbs2.com" 0 "$0d$0a" "$0c$0d$0a"
pause
exit /b

:create the assembler program, by Herbert Kleebauer
echo.Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>"%~1"
echo.0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU!WvX0GwUY Wv;ovBX2Gv0ExGIuht6>>"%~1"
echo.?@}IKuNWpe~Fpe?FNHlF?wGMECIQqo{Ox{T?kPv@jeoSeIlRFD@{AyEKj@>>"%~1"
echo.iqe~1NeAyR?mHAG~BGRgB{~H?o~TsdgCYqe?HR~upkpBG?~slJBCyA?@xA>>"%~1"
echo.LZp{xq`Cs?H[C_vHDyB?Hos@QslFA@wQ~~x}viH}`LYNBGyA?@xAB?sUq`>>"%~1"
echo.LRy@PwtCYQEuFK@A~BxPtDss@fFqjVmzD@qBEOEenU?`eHHeBCMs?FExep>>"%~1"
echo.LHsPBGyA?@xAunjzA}EKNs@CA?wQpQpKLBHv?s`WJ`LRCYyIWMJaejCksl>>"%~1"
echo.H[GyFGhHBwHZjjHeoFasuFUJeHeB?OsQH[xeHCPvqFj@oq@eNc?~}Nu??O>>"%~1"
echo.~oEwoAjBKs?Zp`LBzHQzyEFrAWAG{EFrAqAGYwHTECIQ{coKIsaCsf{Oe~>>"%~1"
echo.CK}Ayre~CNFA{rAyEKFACrA{EKGAjbA}eKGSjNMtQFtc{OAyDGFj?{FDGQ>>"%~1"
echo.KAjNVk_OCAx@e?f{o?CosI}1EGizhljJ~H1ZeG}JBA~rACBMDGjjDG@g0>>"%~1"
goto :eof

Image

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

Re: echo <FF> (to screen or a file)

#5 Post by aGerman » 26 Jul 2010 19:56

Well guys, all this solutions are using 16 bit applications (.com). You can't use it on 64 bit system if you have no DOSBox installed.
In this case I see no possibility using native batch.

Code: Select all

@echo off &setlocal

:: temporary VBScript to get the character
>"%temp%\ff.vbs" echo WScript.Echo Chr(12)
for /f %%a in ('cscript //nologo "%temp%\ff.vbs"') do (set "ff=%%a" &del "%temp%\ff.vbs")

echo.%ff%

pause

Regards
aGerman

alan_b
Expert
Posts: 357
Joined: 04 Oct 2008 09:49

Re: echo <FF> (to screen or a file)

#6 Post by alan_b » 10 Aug 2010 13:25

Is Edlin a good alternative to Notepad.

I find Edlin and Debug are still present in XP

I vaguely recall being able to put any chosen characters into a file with either Edlin or Debug,
Those were the good old days when real men only used real DOS,
and the wimps had hobbies like stamp collecting because no Windows GUI thing had happened ! !

Alan

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: echo <FF> (to screen or a file)

#7 Post by !k » 10 Aug 2010 13:54

alan_b wrote:Those were the good old days when real men only used real DOS
Thanx, Alan

Code: Select all

@echo off
set "scr=0c0d0a.scr"
echo N 0c0d0a.txt> "%scr%"
echo E 0100 0C 0D 0A>> "%scr%"
for %%s in (RCX 0003 W Q) do echo %%s>> "%scr%"
debug< "%scr%" >nul
del /q "%scr%"
start 0c0d0a.txt
:mrgreen:

alan_b
Expert
Posts: 357
Joined: 04 Oct 2008 09:49

Re: echo <FF> (to screen or a file)

#8 Post by alan_b » 10 Aug 2010 14:37

Gosh, you were quick on that ! !

I am now more than a Real Man, I am a Real Old Man with vague recollections.

I am glad you were able to pick up the hint and run with it.
If I needed to use those tools now I would have Google for the "how to ...".

One thing I do remember is composing a self modifying batch script that terminated with
"CD "
and had no Ctrl Z or CR/LF or anything else following the space character.
This allowed a subsequent >> append to stipulate a directory to be changed to.

I remember the Company installed super malware protection which was fine at defending against the latest threat of a batch script with the command FORMAT,
but it really hated and quarantined/mutilated my innocent script without the expected termination.

Alan

Post Reply