Page 1 of 1

echo <FF> (to screen or a file)

Posted: 22 Jul 2010 07:59
by miskox
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

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

Posted: 22 Jul 2010 09:07
by jeb
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

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

Posted: 26 Jul 2010 04:27
by miskox
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

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

Posted: 26 Jul 2010 15:25
by !k
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

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

Posted: 26 Jul 2010 19:56
by aGerman
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

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

Posted: 10 Aug 2010 13:25
by alan_b
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

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

Posted: 10 Aug 2010 13:54
by !k
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:

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

Posted: 10 Aug 2010 14:37
by alan_b
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