GenChr.cmd

Generate the ASCII/Unicode character for any byte value. The output is a file bytevalue.chr

  @echo off
  set "USAGE=echo:Usage: Supply an integer 0-255& goto :EOF"
  if "%~1" equ "" %USAGE%
  set /a "val=%~1" 2>nul
  if "%~1" neq "%val%" %USAGE%
  if %~1 lss 0    %USAGE%
  if %~1 gtr 255  %USAGE%

  set tempfile=%~1.tmp
  set "options=/d compress=off /d reserveperdatablocksize=26"
  if %~1 neq 26  (type nul >"%tempfile%"
  makecab %options% /d reserveperfoldersize=%~1 "%tempfile%" %~1.chr >nul
  type %~1.chr | (
  (for /l %%N in (1 1 38) do pause)>nul&findstr "^">"%tempfile%")
  >nul copy /y "%tempfile%" /a %~1.chr /b
  del "%tempfile%"
  ) else (copy /y nul + nul /a 26.chr /a >nul)

Written via the teamwork of carlos, penpen, aGerman, dbenham & bluesxman - see forum thread

MakeCab is available from Windows 2000 to Windows 8.

Examples

Create the 0 or NUL character (file 0.chr)
genchr.cmd 0

Create the 9 or tab character. (file 9.chr)
genchr.cmd 9

Create all 256 characters/files:
for /l %a in (0,1,255) do start "" cmd /c genchr %a

“When the character of a man is not clear to you, look at his friends” ~ Japanese Proverb

Related

Ascii table
MAKECAB Create .CAB files


© Copyright SS64.com 1999-2014
Some rights reserved