Create nul and all ascii characters with only batch
Moderator: DosItHelp
-
- Posts: 2
- Joined: 06 May 2018 08:49
Re: Create nul and all ascii characters with only batch
The program is not work in win10. copy file /b newfile /a is not work in win10.
Re: Create nul and all ascii characters with only batch
@batmanbatman please you can provide more details about your windows 10 version, like codepage that you use?batmanbatman wrote: ↑06 May 2018 08:53The program is not work in win10. copy file /b newfile /a is not work in win10.
Last edited by carlos on 06 May 2018 14:52, edited 1 time in total.
Re: Create nul and all ascii characters with only batch
On this thread (viewtopic.php?f=3&t=8513), with sst user we found that the codepage used affect the result of the .chr files. The case is when the user uses a native double byte code page like 932 or 950.
Here, is a patched version.
Here, is a patched version.
Code: Select all
:: This code creates one single byte. Parameter: <int>0-255
:: Teamwork of carlos, penpen, aGerman, dbenham, bluesxman, sst
:: Tested under Win2000, XP, Win7, Win8, Win10
:: Fixed issue on environments with dbcs codepage
@echo off
setlocal enableextensions
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%
for /f "tokens=*" %%a in ('chcp') do for %%b in (%%a) do set "cp=%%~nb"
set "options=/d compress=off /d reserveperdatablocksize=26"
set "cmd=cmd /d /c"
mode con cp select=437 >nul
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 %cmd% copy /y %~1.tmp /a %~1.chr /b
del %~1.tmp
) else (%cmd% copy /y nul + nul /a 26.chr /a >nul)
mode con cp select=%cp% >nul
Last edited by carlos on 02 Sep 2018 02:51, edited 1 time in total.
Re: Create nul and all ascii characters with only batch
@batmanbatman
To make it easier for you to provide the informations that Carlos requests you could run info.bat to be found there:
viewtopic.php?f=3&t=7420&p=49133#p49133
After you run the script an editor window will pop up. Just copy the whole content and paste it to your answer.
Steffen
To make it easier for you to provide the informations that Carlos requests you could run info.bat to be found there:
viewtopic.php?f=3&t=7420&p=49133#p49133
After you run the script an editor window will pop up. Just copy the whole content and paste it to your answer.
Steffen
-
- Posts: 2
- Joined: 06 May 2018 08:49
Re: Create nul and all ascii characters with only batch
"copy file /a newfile /b" is not work in win10.
"Not work" means:
1. after create a file by makecab.
2. The first two byte created by makecab and skip 38 byte is correct. Eg: 81 1A ....
3. copy "tempfile" /a 129.chr /b"
4. 129.chr same of tempfile. (ie. fc 129.chr tempfile is no different).
5. If Ascii is not extend ascii, everything is ok.
My computer: Microsoft Windows [ver 10.0.16299.371]. I try all code page. 437-65001. font =TT
"Not work" means:
1. after create a file by makecab.
2. The first two byte created by makecab and skip 38 byte is correct. Eg: 81 1A ....
3. copy "tempfile" /a 129.chr /b"
4. 129.chr same of tempfile. (ie. fc 129.chr tempfile is no different).
5. If Ascii is not extend ascii, everything is ok.
My computer: Microsoft Windows [ver 10.0.16299.371]. I try all code page. 437-65001. font =TT
Re: Create nul and all ascii characters with only batch
Have you already tested the latest code carlos gave two posts about yours, or does the analysis base on the original version?
penpen
penpen