Create nul and all ascii characters with only batch

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
foxidrive
Expert
Posts: 6033
Joined: 10 Feb 2012 02:20

Re: Create nul and all ascii characters with only batch

#91 Post by foxidrive » 14 Feb 2014 09:06

dbenham wrote:
foxidrive wrote:I don't understand. A dual core will return 2 right?

Yes - %NUMBER-OF-PROCESSORS% returns 4 for my machine that has a single quad core CPU

Dave Benham


Thanks Dave, I'm not sure what carlos was driving at.
My point was that single core machines are mostly 14 years old and supporting them seems anachronistic.

The Wiki article shows that Dual cores were introduced way back then.

einstein1969
Expert
Posts: 774
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Create nul and all ascii characters with only batch

#92 Post by einstein1969 » 14 Feb 2014 13:48

foxidrive wrote:
dbenham wrote:
foxidrive wrote:I don't understand. A dual core will return 2 right?

Yes - %NUMBER-OF-PROCESSORS% returns 4 for my machine that has a single quad core CPU

Dave Benham


Thanks Dave, I'm not sure what carlos was driving at.
My point was that single core machines are mostly 14 years old and supporting them seems anachronistic.

The Wiki article shows that Dual cores were introduced way back then.


But the one-core production not stop 14 year ago. I have a turion released in 2006. But there are newer.

einstein1969

foxidrive
Expert
Posts: 6033
Joined: 10 Feb 2012 02:20

Re: Create nul and all ascii characters with only batch

#93 Post by foxidrive » 14 Feb 2014 20:35

einstein1969 wrote:But the one-core production not stop 14 year ago. I have a turion released in 2006. But there are newer.

einstein1969


You would be one of very few computer enthusiasts who use a single core machine in normal use. :)

FWIW I have a P4 2.8 GHz 478 pin CPU machine but that is only for backup storage.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Create nul and all ascii characters with only batch

#94 Post by Ed Dyreen » 16 Feb 2014 06:35

More often people use a 15 year old pc because their hardware meets their requirements.

foxidrive
Expert
Posts: 6033
Joined: 10 Feb 2012 02:20

Re: Create nul and all ascii characters with only batch

#95 Post by foxidrive » 16 Feb 2014 07:06

Ed Dyreen wrote:More often people use a 15 year old pc because their hardware meets their requirements.


USB 1.1 :D :D

penpen
Expert
Posts: 1808
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Create nul and all ascii characters with only batch

#96 Post by penpen » 20 Feb 2014 14:10

I had another idea to speed up the file creation.
The first time the following batch is executed it is slow as it uses an old version (slightly variated) of the algorithm: You may add the later one instead.
But it also extends the batch file to contain all binary data values (except NUL).

On the second run it loads these precomputed binary data and uses it to create the files (for most except 0x0A, 0x0D) in a (hopefully) faster way (at least on the pcs i've tested it).

This is mainly thought to be used by batch applications that only needs the binary data for internal use, so i declared the (fast) creation of the files as an "example application":

Code: Select all

@echo off
setlocal
call :_loadTable
if defined error (
   echo %error%
   goto :eof
)
:: Be careful by manually editing the upper part.
:: #############################################################################
:: Feel free to edit this part under these restrictions:
:: - Occupied labels; do not (re)define: _binaryTable, _loadTable, eof.
:: - Occupied labels; do not use       : _binaryTable, _loadTable.
:: - Occupied file names, do not use: "t.tmp", "temp.tmp", "characters\00.chr", ..., "characters\FF.chr".
:: - Occupied path names, do not use: ".\characters"
:: - Occupied character, do not use the special key with the code: 0x1A

:: example application: create each file of these "characters\00.chr", ..., "characters\FF.chr" if not exist.
md characters 2> nul
pushd "characters"

:: values (characters) won't work (at least under; has to be tested on other windows versions):
:: - 00 (NUL), 22 ("), 3D (=) (win xp x64)
:: - 09 (HT), 0A (LF), 0B (VT), 0C (FF), 0D (CR), 20 (SP), FF (FN)

setlocal enableDelayedExpansion
REM This code creates files containing one single Byte each 0x0A until 0x0D
REM Teamwork of carlos, penpen, aGerman, dbenham
REM Tested under Win2000, XP, Win7, Win8
>"t.tmp" type nul
for %%a in (0A 0D) do if not exist "%%a.chr" for /L %%N in (0x%%a, 1, 0x%%a) do (
   makecab /d compress=off /d reserveperfoldersize=%%N /d reserveperdatablocksize=26 "t.tmp" "%%a.chr"
   type "%%a.chr" | ((for /l %%N in (1 1 38) do pause)&(findstr "^">"temp.tmp"))
   copy /y "temp.tmp" /a "%%a.chr" /b
) > nul

REM now simpler created Byte values per file
for %%a in (09 0B 0C 20 3D FF) do if not exist "%%a.chr" (
   cmd /D /A /C echo(!table:~0x%%a,1!!table:~0x1A,1! < nul > "temp.tmp"
   copy /Y "temp.tmp" /A "%%a.chr" /B > nul
) > nul

for %%h in (0 1 2 3 4 5 6 7 8 9 A B C D E F) do for %%l in (0 1 2 3 4 5 6 7 8 9 A B C D E F) do if not exist "%%h%%l.chr" (
   if "%%h%%l" == "00" (
      cmd /D /U /C set /P "=a" < nul > "00.chr"
      copy /y "00.chr" + nul "00.chr" > nul
      type "00.chr" | ((pause > nul) & (findstr "^">"temp.tmp"))
      copy /y "temp.tmp" /a "00.chr" /b > nul
   ) else if "%%h%%l" == "22" (
      cmd /D /A /C echo("!table:~0x1A,1!" < nul > "temp.tmp"
      copy /Y "temp.tmp" /A "22.chr" /B > nul
   ) else (
      set /P "=!table:~0x%%h%%l,1!" < nul > "%%h%%l.chr"
   )
)
del "t.tmp" "temp.tmp"

:next
endlocal

popd


:: #############################################################################
:: Be careful by manually editing the below part.
endlocal
goto :eof


:_binaryTable
set "error=Unknown error occured: Binary part could not be appended - maybe write protected."
echo The binary data is created and appended to this file, this may take a while.
md "characters" 2>nul
pushd "characters"

:: #####################################
:: This is an older version in an slightly different variation.
:: I, m not sure what is the fastest version, so i took this one, as it would only speed up the first run (normally).
:: It may be replaced by any newer (== faster) version.
:: In addition i have used the actual directory ".", instead of ".\characters", as i have "pushed" it above
REM This code creates 256 files containing one single Byte each from 0x00 until 0xFF
REM Teamwork of carlos, penpen, aGerman, dbenham
REM Tested under Win2000, XP, Win7, Win8

>"t.tmp" type nul
(
   for %%A in (0 1 2 3 4 5 6 7 8 9 A B C D E F) do for %%B in (0 1 2 3 4 5 6 7 8 9 A B C D E F) do for /L %%N in (0x%%A%%B, 1, 0x%%A%%B) do (
      makecab /d compress=off /d reserveperfoldersize=%%N /d reserveperdatablocksize=26 "t.tmp" "%%A%%B.chr"
      type "%%A%%B.chr" | ((for /l %%I in (1 1 38) do pause)&(findstr "^">"temp.tmp"))
      copy /y "temp.tmp" /a "%%A%%B.chr" /b
   )
   copy /y nul + nul /a "1A.chr" /a
) > nul
del "t.tmp" "temp.tmp"
:: #####################################

:: ensure no binary data following 0x1A is used; if needed remove all data after the SUB character (0x1A)
copy "%~dpf0" /A "t.tmp" /B > nul

:: Append: binary data starting with 0x1A
for %%c in (1A 0D 0A 20) do ( copy "t.tmp" /B + "%%~c.chr" /B + "t.tmp" /B > nul )
for %%l in (1 2 3 4 5 6 7 8 9 A B C D E F) do ( copy "t.tmp" /B + "0%%~l.chr" /B + "t.tmp" /B > nul)
for %%h in (1 2 3 4 5 6 7 8 9 A B C D E F) do for %%l in (0 1 2 3 4 5 6 7 8 9 A B C D E F) do ( copy "t.tmp" /B + "%%~h%%~l.chr" /B + "t.tmp" /B > nul)
for %%c in (0D 0A 0D 0A) do ( copy "t.tmp" /B + "%%~c.chr" /B + "t.tmp" /B > nul )

:: Append: loading part; ensure line is not defined
set "line="
(
   cmd /D /A /C echo :_binaryTable
   cmd /D /A /C echo for /F "tokens=1 delims=:" %%%%a in ('findstr /N "^" "%%~dpf0"'^) do set /A "line=%%%%a-13"
   cmd /D /A /C echo if defined line (
   cmd /D /A /C echo    for /L %%%%b in (1,1,%%line%%^) do (
   cmd /D /A /C echo       set "table="
   cmd /D /A /C echo       set /P "table="
   cmd /D /A /C echo    ^)
   cmd /D /A /C echo ^) ^^^< "%%~dpf0"
   cmd /D /A /C echo if not defined table goto :_binaryTable
   cmd /D /A /C echo :: the next line must be the last to ensure that all data is appended.
   cmd /D /A /C echo set "error="
) >> t.tmp

:: Replace the actual batch file, saving binary data, deleting temporary data
copy /Z "t.tmp" /B "%~dpf0" /B > nul
del "t.tmp"
popd

:: Own loading part to avoid endless loop.
for /F "tokens=1 delims=:" %%a in ('findstr /N "^" "%~dpf0"') do set /A "line=%%a-13"
if defined line (
   for /L %%b in (1,1,%line%) do (
      set "table="
      set /P "table="
   )
) < "%~dpf0"

if "%table:~64,16%" == "@ABCDEFGHIJKLMNO" if NOT "%table:~255%" == "" set error=
goto :eof


:_loadTable
set "error=Unknown error occured: Environment variable table not loaded properly."
for %%a in (table line) do set "%%~a="
goto :_binaryTable

:: if no binary table data is available this is the eof, else the next line contains the binary data.
I hope you find this useful, too.

penpen

carlos
Expert
Posts: 501
Joined: 20 Aug 2010 13:57
Location: Chile
Contact:

Re: Create nul and all ascii characters with only batch

#97 Post by carlos » 31 Mar 2014 05:37

I included the simple code here:

http://consolesoft.com/batch/binary/index.html

This is like spam :o , but is for you know that the code is also easily available in that url.

Sponge Belly
Posts: 197
Joined: 01 Oct 2012 13:32
Location: Ireland
Contact:

Re: Create nul and all ascii characters with only batch

#98 Post by Sponge Belly » 26 Oct 2014 12:53

Hello All! :)

I modified the code developed in this thread to store a tab in a variable:

Code: Select all

@echo off & setlocal enableextensions disabledelayedexpansion

type nul >tab.tmp
makecab /d compress=off /d reserveperdatablocksize=0 ^
/d reserveperfoldersize=9 tab.tmp tab.tmp >nul
for /f "skip=28 delims=" %%T in ('find /v "" tab.tmp') do (
set "tab=%%T" & goto break)
:break
del tab.tmp
echo(words%tab%separated%tab%by%tab%tabs

endlocal & exit /b 0


I hope you find this useful.

BFN!

- SB

Squashman
Expert
Posts: 4150
Joined: 23 Dec 2011 13:59

Re: Create nul and all ascii characters with only batch

#99 Post by Squashman » 26 Oct 2014 17:46

I thought we could already do it with the FORFILES command.

Sponge Belly
Posts: 197
Joined: 01 Oct 2012 13:32
Location: Ireland
Contact:

Re: Create nul and all ascii characters with only batch

#100 Post by Sponge Belly » 27 Oct 2014 04:15

Hi Squashman,

Dave Benham first proposed using forfiles to generate nearly any character, including tab 2 years ago.

As noted at the time, the trouble with forfiles is that it isn’t present on all versions of Windows. Makecab, otoh, is. So my little snippet should work out-of-the-box on XP and above.

- SB

Squashman
Expert
Posts: 4150
Joined: 23 Dec 2011 13:59

Re: Create nul and all ascii characters with only batch

#101 Post by Squashman » 27 Oct 2014 06:40

Sponge Belly wrote:Hi Squashman,

Dave Benham first proposed using forfiles to generate nearly any character, including tab 2 years ago.

As noted at the time, the trouble with forfiles is that it isn’t present on all versions of Windows. Makecab, otoh, is. So my little snippet should work out-of-the-box on XP and above.

- SB

Well you basically just regurgitated what I said in that thread. :wink:

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

Re: Create nul and all ascii characters with only batch

#102 Post by miskox » 14 Jan 2015 17:34

With the help of this answer viewtopic.php?p=38398#p38398 and this method by Carlos (viewtopic.php?p=14704#p14704 and viewtopic.php?p=4659#p4659) here are two .cmd files that generate binary values.

First creates DEC values (0.chr .... 255.chr) in a _CHRS_ folder (is deleted if it exists).

Code: Select all

@echo off
rd _chrs_>nul 2>nul
md _chrs_
for %%b in (
"4D53434600000000CD1A0000000000002C000000000000000301010000010000AE790000BE1900000100010001000000"
"0000000000002E4616BE20002E5C302E63687200010000000100000000002E4616BE20002E5C312E6368720001000000"
"0200000000002E4616BE20002E5C322E63687200010000000300000000002E4616BE20002E5C332E6368720001000000"
"0400000000002E4616BE20002E5C342E63687200010000000500000000002E4616BE20002E5C352E6368720001000000"
"0600000000002E4616BE20002E5C362E63687200010000000700000000002E4617BE20002E5C372E6368720001000000"
"0800000000002E4617BE20002E5C382E63687200010000000900000000002E4617BE20002E5C392E6368720001000000"
"0A00000000002E4617BE20002E5C31302E63687200010000000B00000000002E4617BE20002E5C31312E636872000100"
"00000C00000000002E4617BE20002E5C31322E63687200010000000D00000000002E4617BE20002E5C31332E63687200"
"010000000E00000000002E4617BE20002E5C31342E63687200010000000F00000000002E4617BE20002E5C31352E6368"
"7200010000001000000000002E4618BE20002E5C31362E63687200010000001100000000002E4618BE20002E5C31372E"
"63687200010000001200000000002E4618BE20002E5C31382E63687200010000001300000000002E4618BE20002E5C31"
"392E63687200010000001400000000002E4618BE20002E5C32302E63687200010000001500000000002E4618BE20002E"
"5C32312E63687200010000001600000000002E4618BE20002E5C32322E63687200010000001700000000002E4618BE20"
"002E5C32332E63687200010000001800000000002E4618BE20002E5C32342E63687200010000001900000000002E4618"
"BE20002E5C32352E63687200010000001A00000000002E4618BE20002E5C32362E63687200010000001B00000000002E"
"4618BE20002E5C32372E63687200010000001C00000000002E4619BE20002E5C32382E63687200010000001D00000000"
"002E4619BE20002E5C32392E63687200010000001E00000000002E4619BE20002E5C33302E63687200010000001F0000"
"0000002E4619BE20002E5C33312E63687200010000002000000000002E4619BE20002E5C33322E636872000100000021"
"00000000002E4619BE20002E5C33332E63687200010000002200000000002E4619BE20002E5C33342E63687200010000"
"002300000000002E4619BE20002E5C33352E63687200010000002400000000002E4619BE20002E5C33362E6368720001"
"0000002500000000002E4619BE20002E5C33372E63687200010000002600000000002E4619BE20002E5C33382E636872"
"00010000002700000000002E4619BE20002E5C33392E63687200010000002800000000002E4619BE20002E5C34302E63"
"687200010000002900000000002E461ABE20002E5C34312E63687200010000002A00000000002E461ABE20002E5C3432"
"2E63687200010000002B00000000002E461ABE20002E5C34332E63687200010000002C00000000002E461ABE20002E5C"
"34342E63687200010000002D00000000002E461ABE20002E5C34352E63687200010000002E00000000002E461ABE2000"
"2E5C34362E63687200010000002F00000000002E461ABE20002E5C34372E63687200010000003000000000002E461ABE"
"20002E5C34382E63687200010000003100000000002E461ABE20002E5C34392E63687200010000003200000000002E46"
"1ABE20002E5C35302E63687200010000003300000000002E461BBE20002E5C35312E6368720001000000340000000000"
"2E461BBE20002E5C35322E63687200010000003500000000002E461BBE20002E5C35332E636872000100000036000000"
"00002E461BBE20002E5C35342E63687200010000003700000000002E461BBE20002E5C35352E63687200010000003800"
"000000002E461BBE20002E5C35362E63687200010000003900000000002E461BBE20002E5C35372E6368720001000000"
"3A00000000002E461BBE20002E5C35382E63687200010000003B00000000002E461BBE20002E5C35392E636872000100"
"00003C00000000002E461BBE20002E5C36302E63687200010000003D00000000002E461BBE20002E5C36312E63687200"
"010000003E00000000002E461BBE20002E5C36322E63687200010000003F00000000002E461BBE20002E5C36332E6368"
"7200010000004000000000002E461CBE20002E5C36342E63687200010000004100000000002E461CBE20002E5C36352E"
"63687200010000004200000000002E461CBE20002E5C36362E63687200010000004300000000002E461CBE20002E5C36"
"372E63687200010000004400000000002E461CBE20002E5C36382E63687200010000004500000000002E461CBE20002E"
"5C36392E63687200010000004600000000002E461CBE20002E5C37302E63687200010000004700000000002E461CBE20"
"002E5C37312E63687200010000004800000000002E461CBE20002E5C37322E63687200010000004900000000002E461C"
"BE20002E5C37332E63687200010000004A00000000002E461CBE20002E5C37342E63687200010000004B00000000002E"
"461CBE20002E5C37352E63687200010000004C00000000002E461DBE20002E5C37362E63687200010000004D00000000"
"002E461DBE20002E5C37372E63687200010000004E00000000002E461DBE20002E5C37382E63687200010000004F0000"
"0000002E461DBE20002E5C37392E63687200010000005000000000002E461DBE20002E5C38302E636872000100000051"
"00000000002E461DBE20002E5C38312E63687200010000005200000000002E461DBE20002E5C38322E63687200010000"
"005300000000002E461DBE20002E5C38332E63687200010000005400000000002E461DBE20002E5C38342E6368720001"
"0000005500000000002E461DBE20002E5C38352E63687200010000005600000000002E4620BE20002E5C38362E636872"
"00010000005700000000002E4620BE20002E5C38372E63687200010000005800000000002E4620BE20002E5C38382E63"
"687200010000005900000000002E4620BE20002E5C38392E63687200010000005A00000000002E4620BE20002E5C3930"
"2E63687200010000005B00000000002E4620BE20002E5C39312E63687200010000005C00000000002E4620BE20002E5C"
"39322E63687200010000005D00000000002E4620BE20002E5C39332E63687200010000005E00000000002E4620BE2000"
"2E5C39342E63687200010000005F00000000002E4620BE20002E5C39352E63687200010000006000000000002E4620BE"
"20002E5C39362E63687200010000006100000000002E4621BE20002E5C39372E63687200010000006200000000002E46"
"21BE20002E5C39382E63687200010000006300000000002E4621BE20002E5C39392E6368720001000000640000000000"
"2E4621BE20002E5C3130302E63687200010000006500000000002E4621BE20002E5C3130312E63687200010000006600"
"000000002E4621BE20002E5C3130322E63687200010000006700000000002E4621BE20002E5C3130332E636872000100"
"00006800000000002E4621BE20002E5C3130342E63687200010000006900000000002E4621BE20002E5C3130352E6368"
"7200010000006A00000000002E4621BE20002E5C3130362E63687200010000006B00000000002E4621BE20002E5C3130"
"372E63687200010000006C00000000002E4621BE20002E5C3130382E63687200010000006D00000000002E4621BE2000"
"2E5C3130392E63687200010000006E00000000002E4622BE20002E5C3131302E63687200010000006F00000000002E46"
"22BE20002E5C3131312E63687200010000007000000000002E4622BE20002E5C3131322E636872000100000071000000"
"00002E4622BE20002E5C3131332E63687200010000007200000000002E4622BE20002E5C3131342E6368720001000000"
"7300000000002E4622BE20002E5C3131352E63687200010000007400000000002E4622BE20002E5C3131362E63687200"
"010000007500000000002E4622BE20002E5C3131372E63687200010000007600000000002E4622BE20002E5C3131382E"
"63687200010000007700000000002E4622BE20002E5C3131392E63687200010000007800000000002E4622BE20002E5C"
"3132302E63687200010000007900000000002E4623BE20002E5C3132312E63687200010000007A00000000002E4623BE"
"20002E5C3132322E63687200010000007B00000000002E4623BE20002E5C3132332E63687200010000007C0000000000"
"2E4623BE20002E5C3132342E63687200010000007D00000000002E4623BE20002E5C3132352E63687200010000007E00"
"000000002E4623BE20002E5C3132362E63687200010000007F00000000002E4623BE20002E5C3132372E636872000100"
"00008000000000002E4623BE20002E5C3132382E63687200010000008100000000002E4623BE20002E5C3132392E6368"
"7200010000008200000000002E4623BE20002E5C3133302E63687200010000008300000000002E4623BE20002E5C3133"
"312E63687200010000008400000000002E4623BE20002E5C3133322E63687200010000008500000000002E4623BE2000"
"2E5C3133332E63687200010000008600000000002E4624BE20002E5C3133342E63687200010000008700000000002E46"
"24BE20002E5C3133352E63687200010000008800000000002E4624BE20002E5C3133362E636872000100000089000000"
"00002E4624BE20002E5C3133372E63687200010000008A00000000002E4624BE20002E5C3133382E6368720001000000"
"8B00000000002E4624BE20002E5C3133392E63687200010000008C00000000002E4624BE20002E5C3134302E63687200"
"010000008D00000000002E4624BE20002E5C3134312E63687200010000008E00000000002E4624BE20002E5C3134322E"
"63687200010000008F00000000002E4624BE20002E5C3134332E63687200010000009000000000002E4624BE20002E5C"
"3134342E63687200010000009100000000002E4625BE20002E5C3134352E63687200010000009200000000002E4625BE"
"20002E5C3134362E63687200010000009300000000002E4625BE20002E5C3134372E6368720001000000940000000000"
"2E4625BE20002E5C3134382E63687200010000009500000000002E4625BE20002E5C3134392E63687200010000009600"
"000000002E4625BE20002E5C3135302E63687200010000009700000000002E4625BE20002E5C3135312E636872000100"
"00009800000000002E4625BE20002E5C3135322E63687200010000009900000000002E4625BE20002E5C3135332E6368"
"7200010000009A00000000002E4625BE20002E5C3135342E63687200010000009B00000000002E4625BE20002E5C3135"
"352E63687200010000009C00000000002E4625BE20002E5C3135362E63687200010000009D00000000002E4626BE2000"
"2E5C3135372E63687200010000009E00000000002E4626BE20002E5C3135382E63687200010000009F00000000002E46"
"26BE20002E5C3135392E6368720001000000A000000000002E4626BE20002E5C3136302E6368720001000000A1000000"
"00002E4626BE20002E5C3136312E6368720001000000A200000000002E4626BE20002E5C3136322E6368720001000000"
"A300000000002E4626BE20002E5C3136332E6368720001000000A400000000002E4626BE20002E5C3136342E63687200"
"01000000A500000000002E4626BE20002E5C3136352E6368720001000000A600000000002E4626BE20002E5C3136362E"
"6368720001000000A700000000002E4626BE20002E5C3136372E6368720001000000A800000000002E4626BE20002E5C"
"3136382E6368720001000000A900000000002E4627BE20002E5C3136392E6368720001000000AA00000000002E4627BE"
"20002E5C3137302E6368720001000000AB00000000002E4627BE20002E5C3137312E6368720001000000AC0000000000"
"2E4627BE20002E5C3137322E6368720001000000AD00000000002E4627BE20002E5C3137332E6368720001000000AE00"
"000000002E4627BE20002E5C3137342E6368720001000000AF00000000002E4627BE20002E5C3137352E636872000100"
"0000B000000000002E4627BE20002E5C3137362E6368720001000000B100000000002E4627BE20002E5C3137372E6368"
"720001000000B200000000002E4627BE20002E5C3137382E6368720001000000B300000000002E4627BE20002E5C3137"
"392E6368720001000000B400000000002E4627BE20002E5C3138302E6368720001000000B500000000002E4628BE2000"
"2E5C3138312E6368720001000000B600000000002E4628BE20002E5C3138322E6368720001000000B700000000002E46"
"28BE20002E5C3138332E6368720001000000B800000000002E4628BE20002E5C3138342E6368720001000000B9000000"
"00002E4628BE20002E5C3138352E6368720001000000BA00000000002E4628BE20002E5C3138362E6368720001000000"
"BB00000000002E4628BE20002E5C3138372E6368720001000000BC00000000002E4628BE20002E5C3138382E63687200"
"01000000BD00000000002E4628BE20002E5C3138392E6368720001000000BE00000000002E4628BE20002E5C3139302E"
"6368720001000000BF00000000002E4628BE20002E5C3139312E6368720001000000C000000000002E4628BE20002E5C"
"3139322E6368720001000000C100000000002E4628BE20002E5C3139332E6368720001000000C200000000002E4629BE"
"20002E5C3139342E6368720001000000C300000000002E4629BE20002E5C3139352E6368720001000000C40000000000"
"2E4629BE20002E5C3139362E6368720001000000C500000000002E4629BE20002E5C3139372E6368720001000000C600"
"000000002E4629BE20002E5C3139382E6368720001000000C700000000002E4629BE20002E5C3139392E636872000100"
"0000C800000000002E4629BE20002E5C3230302E6368720001000000C900000000002E4629BE20002E5C3230312E6368"
"720001000000CA00000000002E4629BE20002E5C3230322E6368720001000000CB00000000002E4629BE20002E5C3230"
"332E6368720001000000CC00000000002E4629BE20002E5C3230342E6368720001000000CD00000000002E4629BE2000"
"2E5C3230352E6368720001000000CE00000000002E462ABE20002E5C3230362E6368720001000000CF00000000002E46"
"2ABE20002E5C3230372E6368720001000000D000000000002E462ABE20002E5C3230382E6368720001000000D1000000"
"00002E462ABE20002E5C3230392E6368720001000000D200000000002E462ABE20002E5C3231302E6368720001000000"
"D300000000002E462ABE20002E5C3231312E6368720001000000D400000000002E462ABE20002E5C3231322E63687200"
"01000000D500000000002E462ABE20002E5C3231332E6368720001000000D600000000002E462ABE20002E5C3231342E"
"6368720001000000D700000000002E462ABE20002E5C3231352E6368720001000000D800000000002E462ABE20002E5C"
"3231362E6368720001000000D900000000002E462ABE20002E5C3231372E6368720001000000DA00000000002E462BBE"
"20002E5C3231382E6368720001000000DB00000000002E462BBE20002E5C3231392E6368720001000000DC0000000000"
"2E462BBE20002E5C3232302E6368720001000000DD00000000002E462BBE20002E5C3232312E6368720001000000DE00"
"000000002E462BBE20002E5C3232322E6368720001000000DF00000000002E462BBE20002E5C3232332E636872000100"
"0000E000000000002E462BBE20002E5C3232342E6368720001000000E100000000002E462BBE20002E5C3232352E6368"
"720001000000E200000000002E462BBE20002E5C3232362E6368720001000000E300000000002E462BBE20002E5C3232"
"372E6368720001000000E400000000002E462BBE20002E5C3232382E6368720001000000E500000000002E462BBE2000"
"2E5C3232392E6368720001000000E600000000002E462CBE20002E5C3233302E6368720001000000E700000000002E46"
"2CBE20002E5C3233312E6368720001000000E800000000002E462CBE20002E5C3233322E6368720001000000E9000000"
"00002E462CBE20002E5C3233332E6368720001000000EA00000000002E462CBE20002E5C3233342E6368720001000000"
"EB00000000002E462CBE20002E5C3233352E6368720001000000EC00000000002E462CBE20002E5C3233362E63687200"
"01000000ED00000000002E462CBE20002E5C3233372E6368720001000000EE00000000002E462CBE20002E5C3233382E"
"6368720001000000EF00000000002E462CBE20002E5C3233392E6368720001000000F000000000002E462CBE20002E5C"
"3234302E6368720001000000F100000000002E462CBE20002E5C3234312E6368720001000000F200000000002E462DBE"
"20002E5C3234322E6368720001000000F300000000002E462DBE20002E5C3234332E6368720001000000F40000000000"
"2E462DBE20002E5C3234342E6368720001000000F500000000002E462DBE20002E5C3234352E6368720001000000F600"
"000000002E462DBE20002E5C3234362E6368720001000000F700000000002E462DBE20002E5C3234372E636872000100"
"0000F800000000002E462DBE20002E5C3234382E6368720001000000F900000000002E462DBE20002E5C3234392E6368"
"720001000000FA00000000002E462DBE20002E5C3235302E6368720001000000FB00000000002E462DBE20002E5C3235"
"312E6368720001000000FC00000000002E462DBE20002E5C3235322E6368720001000000FD00000000002E462DBE2000"
"2E5C3235332E6368720001000000FE00000000002E462EBE20002E5C3235342E6368720001000000FF00000000002E46"
"2EBE20002E5C3235352E6368720047B5FD0107010001434B010001FFFE000102030405060708090A0B0C0D0E0F101112"
"131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142"
"434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172"
"737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2"
"A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2"
"D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFE"
"FF") Do >>chrsDEC.cab (Echo.For b=1 To len^(%%b^) Step 2
Echo WScript.StdOut.Write Chr^(CByte^("&H"^&Mid^(%%b,b,2^)^)^) : Next)
Cscript /b /e:vbs chrsDEC.cab > chrsDEC.ca_
Expand chrsDEC.ca_ -F:*.chr _chrs_>nul 2>nul
if exist chrsDEC.ca_ del chrsDEC.ca_
if exist chrsDEC.cab del chrsDEC.cab


The second one generates HEX values (00.chr .... FF.chr) in the _CHRS_ folder.

Code: Select all

@echo off
rd _chrs_>nul 2>nul
md _chrs_
for %%b in (
"4D534346000000003B1A0000000000002C000000000000000301010000010000406900002C1900000100010001000000"
"0000000000002F462F0020002E5C30302E63687200010000000100000000002F462F0020002E5C30312E636872000100"
"00000200000000002F462F0020002E5C30322E63687200010000000300000000002F462F0020002E5C30332E63687200"
"010000000400000000002F462F0020002E5C30342E63687200010000000500000000002F462F0020002E5C30352E6368"
"7200010000000600000000002F462F0020002E5C30362E63687200010000000700000000002F462F0020002E5C30372E"
"63687200010000000800000000002F462F0020002E5C30382E63687200010000000900000000002F462F0020002E5C30"
"392E63687200010000000A00000000002F462F0020002E5C30412E63687200010000000B00000000002F462F0020002E"
"5C30422E63687200010000000C00000000002F462F0020002E5C30432E63687200010000000D00000000002F462F0020"
"002E5C30442E63687200010000000E00000000002F462F0020002E5C30452E63687200010000000F00000000002F462F"
"0020002E5C30462E63687200010000001000000000002F462F0020002E5C31302E63687200010000001100000000002F"
"462F0020002E5C31312E63687200010000001200000000002F462F0020002E5C31322E63687200010000001300000000"
"002F462F0020002E5C31332E63687200010000001400000000002F462F0020002E5C31342E6368720001000000150000"
"0000002F462F0020002E5C31352E63687200010000001600000000002F462F0020002E5C31362E636872000100000017"
"00000000002F462F0020002E5C31372E63687200010000001800000000002F462F0020002E5C31382E63687200010000"
"001900000000002F462F0020002E5C31392E63687200010000001A00000000002F462F0020002E5C31412E6368720001"
"0000001B00000000002F462F0020002E5C31422E63687200010000001C00000000002F462F0020002E5C31432E636872"
"00010000001D00000000002F462F0020002E5C31442E63687200010000001E00000000002F462F0020002E5C31452E63"
"687200010000001F00000000002F462F0020002E5C31462E63687200010000002000000000002F462F0020002E5C3230"
"2E63687200010000002100000000002F462F0020002E5C32312E63687200010000002200000000002F462F0020002E5C"
"32322E63687200010000002300000000002F462F0020002E5C32332E63687200010000002400000000002F462F002000"
"2E5C32342E63687200010000002500000000002F462F0020002E5C32352E63687200010000002600000000002F462F00"
"20002E5C32362E63687200010000002700000000002F462F0020002E5C32372E63687200010000002800000000002F46"
"2F0020002E5C32382E63687200010000002900000000002F462F0020002E5C32392E63687200010000002A0000000000"
"2F462F0020002E5C32412E63687200010000002B00000000002F462F0020002E5C32422E63687200010000002C000000"
"00002F462F0020002E5C32432E63687200010000002D00000000002F462F0020002E5C32442E63687200010000002E00"
"000000002F462F0020002E5C32452E63687200010000002F00000000002F462F0020002E5C32462E6368720001000000"
"3000000000002F462F0020002E5C33302E63687200010000003100000000002F462F0020002E5C33312E636872000100"
"00003200000000002F462F0020002E5C33322E63687200010000003300000000002F462F0020002E5C33332E63687200"
"010000003400000000002F462F0020002E5C33342E63687200010000003500000000002F462F0020002E5C33352E6368"
"7200010000003600000000002F462F0020002E5C33362E63687200010000003700000000002F462F0020002E5C33372E"
"63687200010000003800000000002F462F0020002E5C33382E63687200010000003900000000002F462F0020002E5C33"
"392E63687200010000003A00000000002F462F0020002E5C33412E63687200010000003B00000000002F462F0020002E"
"5C33422E63687200010000003C00000000002F462F0020002E5C33432E63687200010000003D00000000002F462F0020"
"002E5C33442E63687200010000003E00000000002F462F0020002E5C33452E63687200010000003F00000000002F462F"
"0020002E5C33462E63687200010000004000000000002F462F0020002E5C34302E63687200010000004100000000002F"
"462F0020002E5C34312E63687200010000004200000000002F462F0020002E5C34322E63687200010000004300000000"
"002F462F0020002E5C34332E63687200010000004400000000002F462F0020002E5C34342E6368720001000000450000"
"0000002F462F0020002E5C34352E63687200010000004600000000002F462F0020002E5C34362E636872000100000047"
"00000000002F462F0020002E5C34372E63687200010000004800000000002F462F0020002E5C34382E63687200010000"
"004900000000002F462F0020002E5C34392E63687200010000004A00000000002F462F0020002E5C34412E6368720001"
"0000004B00000000002F462F0020002E5C34422E63687200010000004C00000000002F462F0020002E5C34432E636872"
"00010000004D00000000002F462F0020002E5C34442E63687200010000004E00000000002F462F0020002E5C34452E63"
"687200010000004F00000000002F462F0020002E5C34462E63687200010000005000000000002F462F0020002E5C3530"
"2E63687200010000005100000000002F462F0020002E5C35312E63687200010000005200000000002F462F0020002E5C"
"35322E63687200010000005300000000002F462F0020002E5C35332E63687200010000005400000000002F462F002000"
"2E5C35342E63687200010000005500000000002F462F0020002E5C35352E63687200010000005600000000002F462F00"
"20002E5C35362E63687200010000005700000000002F462F0020002E5C35372E63687200010000005800000000002F46"
"2F0020002E5C35382E63687200010000005900000000002F462F0020002E5C35392E63687200010000005A0000000000"
"2F462F0020002E5C35412E63687200010000005B00000000002F462F0020002E5C35422E63687200010000005C000000"
"00002F462F0020002E5C35432E63687200010000005D00000000002F462F0020002E5C35442E63687200010000005E00"
"000000002F462F0020002E5C35452E63687200010000005F00000000002F462F0020002E5C35462E6368720001000000"
"6000000000002F462F0020002E5C36302E63687200010000006100000000002F462F0020002E5C36312E636872000100"
"00006200000000002F462F0020002E5C36322E63687200010000006300000000002F462F0020002E5C36332E63687200"
"010000006400000000002F462F0020002E5C36342E63687200010000006500000000002F462F0020002E5C36352E6368"
"7200010000006600000000002F462F0020002E5C36362E63687200010000006700000000002F462F0020002E5C36372E"
"63687200010000006800000000002F462F0020002E5C36382E63687200010000006900000000002F462F0020002E5C36"
"392E63687200010000006A00000000002F462F0020002E5C36412E63687200010000006B00000000002F462F0020002E"
"5C36422E63687200010000006C00000000002F462F0020002E5C36432E63687200010000006D00000000002F462F0020"
"002E5C36442E63687200010000006E00000000002F462F0020002E5C36452E63687200010000006F00000000002F462F"
"0020002E5C36462E63687200010000007000000000002F462F0020002E5C37302E63687200010000007100000000002F"
"462F0020002E5C37312E63687200010000007200000000002F462F0020002E5C37322E63687200010000007300000000"
"002F462F0020002E5C37332E63687200010000007400000000002F462F0020002E5C37342E6368720001000000750000"
"0000002F462F0020002E5C37352E63687200010000007600000000002F462F0020002E5C37362E636872000100000077"
"00000000002F462F0020002E5C37372E63687200010000007800000000002F462F0020002E5C37382E63687200010000"
"007900000000002F462F0020002E5C37392E63687200010000007A00000000002F462F0020002E5C37412E6368720001"
"0000007B00000000002F462F0020002E5C37422E63687200010000007C00000000002F462F0020002E5C37432E636872"
"00010000007D00000000002F462F0020002E5C37442E63687200010000007E00000000002F462F0020002E5C37452E63"
"687200010000007F00000000002F462F0020002E5C37462E63687200010000008000000000002F462F0020002E5C3830"
"2E63687200010000008100000000002F462F0020002E5C38312E63687200010000008200000000002F462F0020002E5C"
"38322E63687200010000008300000000002F462F0020002E5C38332E63687200010000008400000000002F462F002000"
"2E5C38342E63687200010000008500000000002F462F0020002E5C38352E63687200010000008600000000002F462F00"
"20002E5C38362E63687200010000008700000000002F462F0020002E5C38372E63687200010000008800000000002F46"
"2F0020002E5C38382E63687200010000008900000000002F462F0020002E5C38392E63687200010000008A0000000000"
"2F462F0020002E5C38412E63687200010000008B00000000002F462F0020002E5C38422E63687200010000008C000000"
"00002F462F0020002E5C38432E63687200010000008D00000000002F462F0020002E5C38442E63687200010000008E00"
"000000002F462F0020002E5C38452E63687200010000008F00000000002F462F0020002E5C38462E6368720001000000"
"9000000000002F462F0020002E5C39302E63687200010000009100000000002F462F0020002E5C39312E636872000100"
"00009200000000002F462F0020002E5C39322E63687200010000009300000000002F462F0020002E5C39332E63687200"
"010000009400000000002F462F0020002E5C39342E63687200010000009500000000002F462F0020002E5C39352E6368"
"7200010000009600000000002F462F0020002E5C39362E63687200010000009700000000002F462F0020002E5C39372E"
"63687200010000009800000000002F462F0020002E5C39382E63687200010000009900000000002F462F0020002E5C39"
"392E63687200010000009A00000000002F462F0020002E5C39412E63687200010000009B00000000002F462F0020002E"
"5C39422E63687200010000009C00000000002F462F0020002E5C39432E63687200010000009D00000000002F462F0020"
"002E5C39442E63687200010000009E00000000002F462F0020002E5C39452E63687200010000009F00000000002F462F"
"0020002E5C39462E6368720001000000A000000000002F462F0020002E5C41302E6368720001000000A100000000002F"
"462F0020002E5C41312E6368720001000000A200000000002F462F0020002E5C41322E6368720001000000A300000000"
"002F462F0020002E5C41332E6368720001000000A400000000002F462F0020002E5C41342E6368720001000000A50000"
"0000002F462F0020002E5C41352E6368720001000000A600000000002F462F0020002E5C41362E6368720001000000A7"
"00000000002F462F0020002E5C41372E6368720001000000A800000000002F462F0020002E5C41382E63687200010000"
"00A900000000002F462F0020002E5C41392E6368720001000000AA00000000002F462F0020002E5C41412E6368720001"
"000000AB00000000002F462F0020002E5C41422E6368720001000000AC00000000002F462F0020002E5C41432E636872"
"0001000000AD00000000002F462F0020002E5C41442E6368720001000000AE00000000002F462F0020002E5C41452E63"
"68720001000000AF00000000002F462F0020002E5C41462E6368720001000000B000000000002F462F0020002E5C4230"
"2E6368720001000000B100000000002F462F0020002E5C42312E6368720001000000B200000000002F462F0020002E5C"
"42322E6368720001000000B300000000002F462F0020002E5C42332E6368720001000000B400000000002F462F002000"
"2E5C42342E6368720001000000B500000000002F462F0020002E5C42352E6368720001000000B600000000002F462F00"
"20002E5C42362E6368720001000000B700000000002F462F0020002E5C42372E6368720001000000B800000000002F46"
"2F0020002E5C42382E6368720001000000B900000000002F462F0020002E5C42392E6368720001000000BA0000000000"
"2F462F0020002E5C42412E6368720001000000BB00000000002F462F0020002E5C42422E6368720001000000BC000000"
"00002F462F0020002E5C42432E6368720001000000BD00000000002F462F0020002E5C42442E6368720001000000BE00"
"000000002F462F0020002E5C42452E6368720001000000BF00000000002F462F0020002E5C42462E6368720001000000"
"C000000000002F462F0020002E5C43302E6368720001000000C100000000002F462F0020002E5C43312E636872000100"
"0000C200000000002F462F0020002E5C43322E6368720001000000C300000000002F462F0020002E5C43332E63687200"
"01000000C400000000002F462F0020002E5C43342E6368720001000000C500000000002F462F0020002E5C43352E6368"
"720001000000C600000000002F462F0020002E5C43362E6368720001000000C700000000002F462F0020002E5C43372E"
"6368720001000000C800000000002F462F0020002E5C43382E6368720001000000C900000000002F462F0020002E5C43"
"392E6368720001000000CA00000000002F462F0020002E5C43412E6368720001000000CB00000000002F462F0020002E"
"5C43422E6368720001000000CC00000000002F462F0020002E5C43432E6368720001000000CD00000000002F462F0020"
"002E5C43442E6368720001000000CE00000000002F462F0020002E5C43452E6368720001000000CF00000000002F462F"
"0020002E5C43462E6368720001000000D000000000002F462F0020002E5C44302E6368720001000000D100000000002F"
"462F0020002E5C44312E6368720001000000D200000000002F462F0020002E5C44322E6368720001000000D300000000"
"002F462F0020002E5C44332E6368720001000000D400000000002F462F0020002E5C44342E6368720001000000D50000"
"0000002F462F0020002E5C44352E6368720001000000D600000000002F462F0020002E5C44362E6368720001000000D7"
"00000000002F462F0020002E5C44372E6368720001000000D800000000002F462F0020002E5C44382E63687200010000"
"00D900000000002F462F0020002E5C44392E6368720001000000DA00000000002F462F0020002E5C44412E6368720001"
"000000DB00000000002F462F0020002E5C44422E6368720001000000DC00000000002F462F0020002E5C44432E636872"
"0001000000DD00000000002F462F0020002E5C44442E6368720001000000DE00000000002F462F0020002E5C44452E63"
"68720001000000DF00000000002F462F0020002E5C44462E6368720001000000E000000000002F462F0020002E5C4530"
"2E6368720001000000E100000000002F462F0020002E5C45312E6368720001000000E200000000002F462F0020002E5C"
"45322E6368720001000000E300000000002F462F0020002E5C45332E6368720001000000E400000000002F462F002000"
"2E5C45342E6368720001000000E500000000002F462F0020002E5C45352E6368720001000000E600000000002F462F00"
"20002E5C45362E6368720001000000E700000000002F462F0020002E5C45372E6368720001000000E800000000002F46"
"2F0020002E5C45382E6368720001000000E900000000002F462F0020002E5C45392E6368720001000000EA0000000000"
"2F462F0020002E5C45412E6368720001000000EB00000000002F462F0020002E5C45422E6368720001000000EC000000"
"00002F462F0020002E5C45432E6368720001000000ED00000000002F462F0020002E5C45442E6368720001000000EE00"
"000000002F462F0020002E5C45452E6368720001000000EF00000000002F462F0020002E5C45462E6368720001000000"
"F000000000002F462F0020002E5C46302E6368720001000000F100000000002F462F0020002E5C46312E636872000100"
"0000F200000000002F462F0020002E5C46322E6368720001000000F300000000002F462F0020002E5C46332E63687200"
"01000000F400000000002F462F0020002E5C46342E6368720001000000F500000000002F462F0020002E5C46352E6368"
"720001000000F600000000002F462F0020002E5C46362E6368720001000000F700000000002F462F0020002E5C46372E"
"6368720001000000F800000000002F462F0020002E5C46382E6368720001000000F900000000002F462F0020002E5C46"
"392E6368720001000000FA00000000002F462F0020002E5C46412E6368720001000000FB00000000002F462F0020002E"
"5C46422E6368720001000000FC00000000002F462F0020002E5C46432E6368720001000000FD00000000002F462F0020"
"002E5C46442E6368720001000000FE00000000002F462F0020002E5C46452E6368720001000000FF00000000002F462F"
"0020002E5C46462E6368720047B5FD0107010001434B010001FFFE000102030405060708090A0B0C0D0E0F1011121314"
"15161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F4041424344"
"45464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F7071727374"
"75767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4"
"A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4"
"D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFE"
"FF") Do >>chrsHEX.cab (Echo.For b=1 To len^(%%b^) Step 2
Echo WScript.StdOut.Write Chr^(CByte^("&H"^&Mid^(%%b,b,2^)^)^) : Next)
Cscript /b /e:vbs chrsHEX.cab > chrsHEX.ca_
Expand chrsHEX.ca_ -F:*.chr _chrs_>nul 2>nul
if exist chrsHEX.ca_ del chrsHEX.ca_
if exist chrsHEX.cab del chrsHEX.cab


This mght help (to make .chr files faster).

Saso

Aacini
Expert
Posts: 1631
Joined: 06 Dec 2011 22:15
Location: México City, México

Re: Create nul and all ascii characters with only batch

#103 Post by Aacini » 14 Jan 2015 20:14

miskox wrote:With the help of this answer viewtopic.php?p=38398#p38398 and this method by Carlos (viewtopic.php?p=14704#p14704 and viewtopic.php?p=4659#p4659) here are two .cmd files that generate binary values.

First creates DEC values (0.chr .... 255.chr) in a _CHRS_ folder (is deleted if it exists).

. . . .

The second one generates HEX values (00.chr .... FF.chr) in the _CHRS_ folder.

. . . .

This mght help (to make .chr files faster).

Saso



Excuse me. When I saw examples of this type I am confused, because I can not fathom out what is the purpose of the example. Perhaps is to test other methods in order to prove if they are capable of produce a certain result? If so, then this is a good example, although the original thread have an implicit restriction of not use JScript nor VBS, and your example uses VBS...

If the purpose is to make .chr files in a faster way and VBS is allowed, I think the method below is the simplest one to achieve that goal...

Code: Select all

@echo off
setlocal EnableDelayedExpansion

rem Generate binary values in 0.chr to 255.chr files in DEC_chrs, and 00.chr to FF.chr in HEX_chrs
rem Antonio Perez Ayala

rd /S /Q DEC_chrs HEX_chrs 2> NUL
md DEC_chrs
cd DEC_chrs
echo Dim i,f,fso:Set fso=CreateObject("Scripting.FileSystemObject")>chrs.vbs
echo For i=0 To 255:Set f=fso.CreateTextFile(i^&".chr",True):f.Write Chr(i):f.Close:Next>>chrs.vbs
cscript //nologo chrs.vbs
del chrs.vbs
cd ..

md HEX_chrs
copy DEC_chrs HEX_chrs > NUL
cd HEX_chrs
set HEX=0 1 2 3 4 5 6 7 8 9 A B C D E F
set i=0
for %%a in (%HEX%) do for %%b in (%HEX%) do ren !i!.chr %%a%%b.chr & set /A i+=1
cd ..

Antonio

catalinnc
Posts: 39
Joined: 12 Jan 2015 11:56

Re: Create nul and all ascii characters with only batch

#104 Post by catalinnc » 15 Jan 2015 13:44

dear antonio, your script gives me an error on win xp sp3 uptodate on "141.chr" : "F:\6\DEC_chrs\chrs.vbs(2, 56) Microsoft VBScript runtime error: Invalid procedur
e call or argument"

"141.chr" is zero bytes (instead of 1 byte)

also the content of "140.chr" is 0x4F (expected is 0x8C)

all the other .chr (0 up to 139) are ok

am i missing something?
_

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

Re: Create nul and all ascii characters with only batch

#105 Post by miskox » 18 Feb 2015 07:27

@catalinnc: Aacini's solution works for me.

@Aacini: I made this .cab version for the following reasons:
- makecab version is slow - using .cab solution makes .chr files very quickly (especially if a user wants to make these .chr files each time they are needed and deleted when they are not needed anymore).
- maybe someone wants to have these .chr files in a .cab file for later usage.
- I personally don't mind using your VBS version because it is fast (and VBS is part of the Windows).

Thanks again Aacini for your suggestions/solutions.

Saso

Post Reply