Final simple code for create a byte character (.chr file) using only batch:
You need pass the ascii number that you desire as parameter.
For example, for create the tab character:
genchr.cmd 9
rem 9.chr will be created
Edit Begin: 2018-may-06
genchr.cmd (with fix for run with native double byte codepage)
viewtopic.php?f=3&t=5326&p=56708#p56709
End Edit
genchr.cmd
Code: Select all
REM This code creates one single byte. Parameter: <int>0-255
REM Teamwork of carlos, penpen, aGerman, dbenham
REM Tested under Win2000, XP, Win7, Win8
@echo off
set "options=/d compress=off /d reserveperdatablocksize=26"
if %~1 neq 26 (type nul >%~1.tmp
makecab %options% /d reserveperfoldersize=%~1 %~1.tmp %~1.chr >nul
type %~1.chr | (
(for /l %%N in (1 1 38) do pause)>nul&findstr "^">%~1.tmp)
>nul copy /y %~1.tmp /a %~1.chr /b
del %~1.tmp
) else (copy /y nul + nul /a 26.chr /a >nul)
Code: Select all
http://ss64.com/nt/syntax-genchr.html
speedy stable carlos' version: http://www.dostips.com/forum/viewtopic. ... 495#p32495
speedy stable dbenham' version: http://www.dostips.com/forum/viewtopic. ... 485#p32485
first stable code:
Code: Select all
http://www.dostips.com/forum/viewtopic.php?p=32184#p32184
A really improved and better version is found in this link:
Code: Select all
http://www.dostips.com/forum/viewtopic.php?p=32120#p32120
Hello.
Tested on win8.
Edit: Modification N° 3.
Code: Select all
@Echo Off
::This routine create the file zero.chr that only have the nul character
::Author: Carlos
Set "p=Pause>Nul"
Set "q=%p%&%p%&%p%&%p%&%p%&%p%&%p%&%p%&%p%"
Set "r=%q%%q%%q%%q%%q%%q%%q%%q%%q%"
Set "s=%r%&%p%&%p%"
Copy /Y Nul+Nul /A sub.chr /A >Nul
Makecab /D Compress=OFF sub.chr tmp.cab >Nul
Type tmp.cab |(%s%&Findstr "^") >wnul.tmp
Copy /Y wnul.tmp /A zero.chr /B >Nul
Del sub.chr wnul.tmp tmp.cab
Rem zero.chr have the nul character