You are not logged in.

#1 24 Mar 2014 06:50

Honguito98
Member
From: Mexico
Registered: 19 Sep 2013
Posts: 57

Print special chars in pure batch

I found a way for print control chars like BS, BEL, CR, LF, etc, using a file with these special chars.
For print it, only is required another cmd.exe instance and redirect output to 'con'.

Note 1 : 'Forfiles' command is required for generate some chars.
Note 2 : Tested on Windows 7 Ultimate x64.
Note 3: Long ago, I tried to show these chars, but fails it, now I discover this trick while I get bored, playing with 'con'.

@Echo off
SetLocal
Set "TF=%Tmp%\Chr.txt"
Set LF=^


Call :File
Echo;How to print special chars like BEL BS TAB LF CR:
Echo;-------------------------------------------------
Echo; Only call from any rountine with next command:
Echo;   (Cmd /C %%Tmp%%\Type Chr.txt^)^>Con
Echo;
Echo; Example:
Echo;
Echo; ==Normally==
Type "%TF%"
Echo;
Echo; ==Extended==
( Cmd /C Type "%TF%" ) >Con
Echo; & Echo;
Echo; Now you can see those character you've always wanted
Pause >Nul
Exit

:File
Del %Tf% 2>Nul
:: Generates 1-9 ascii code chars
	For /f eol^=^%LF%%LF%^ delims^= %%A in (
		'forfiles /p "%~dp0." /m "%~nx0" /c "cmd /c <nul set/p=0x010x020x030x040x050x060x070x080x09"'
	) Do (
		<Nul Set/p=%%A>>%TF%
	)
:: Generates a CRLF Char
Echo;>>%TF%
Goto :Eof

.::{Honguito98}::.

Offline

#2 07 Sep 2014 19:00

batchman10
Member
Registered: 07 Sep 2014
Posts: 5

Re: Print special chars in pure batch

Can you explain this a little better
sorry im just a noob looking for the answer to this question


Batch,cmd,batch Games!!! smile

Offline

#3 07 Sep 2014 19:46

npocmaka
Member
From: Bulgaria
Registered: 03 Dec 2009
Posts: 446

Re: Print special chars in pure batch

Offline

Board footer

Powered by