Strange thing

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
miskox
Posts: 630
Joined: 28 Jun 2010 03:46

Strange thing

#1 Post by miskox » 15 Jul 2024 12:22

See this:

Code: Select all

@echo off
setlocal
cls
call :createbinvalue 219 DEL
set filler=&rem
set polnilo=&rem
for /L %%f in (1,1,78) do call set filler=%%char219%%%%filler%%
for /L %%f in (1,1,78) do call set polnilo=%%char219%%%%polnilo%%

echo fill=%filler%
echo poln=%polnilo%
goto :EOF
:createbinvalue
REM par1=decima value between 0 and 255
REM par2: if DEL set the variable only (delete chr file)
md _exe\_chrs_>nul 2>nul
if exist _exe\_chrs_\%1.chr goto :gonext
set "options=/d compress=off /d reserveperdatablocksize=26"
if %~1 neq 26  (type nul >_exe\_chrs_\t.tmp
makecab %options% /d reserveperfoldersize=%~1 _exe\_chrs_\t.tmp _exe\_chrs_\%~1.chr >nul
type _exe\_chrs_\%~1.chr | (
(for /l %%N in (1 1 38) do pause)>nul&findstr "^">_exe\_chrs_\t.tmp)
>nul copy /y _exe\_chrs_\t.tmp /a _exe\_chrs_\%~1.chr /b
del _exe\_chrs_\t.tmp
) else (copy /y nul + nul /a _exe\_chrs_\26.chr /a >nul)
:gonext
if "%2"=="DEL" (
 for /F "delims=" %%y in (_exe\_chrs_\%1.chr) do set "char%1=%%y"
del _exe\_chrs_\%1.chr
rd _exe\_chrs_
)
goto :EOF
Variables filler and polnilo should be the same:

Code: Select all

fill=█78iller
poln=██████████████████████████████████████████████████████████████████████████████

C:\>
The problem lies here:

Code: Select all

for /L %%f in (1,1,78) do call set filler=%%char219%%%%filler%%
Variable must not start with letter 'f' because '%%f' is used.

Saso

jeb
Expert
Posts: 1055
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

Re: Strange thing

#2 Post by jeb » 16 Jul 2024 00:59

Hi miskox,

Code: Select all

for /L %%f in (1,1,78) do call set filler=%%char219%%%%filler%%
It's simply the "f" in "%%f ... iller%%"
You used %%f as your FOR-metavariable, change that or use another variable name

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

Re: Strange thing

#3 Post by miskox » 16 Jul 2024 04:52

jeb wrote:
16 Jul 2024 00:59
Hi miskox,

Code: Select all

for /L %%f in (1,1,78) do call set filler=%%char219%%%%filler%%
It's simply the "f" in "%%f ... iller%%"
You used %%f as your FOR-metavariable, change that or use another variable name
Thank you, Jeb. I noticed that. That's what I wrote at the end. Maybe somebody might have the same problem.

Saso

Post Reply