Need help with variable substitutions and FOR loop
Posted: 19 May 2010 15:16
---
A Forum all about DOS Batch
https://www.dostips.com/forum/
Code: Select all
@echo off &setlocal
for %%a in (a1 a2 a3 a4) do (
set "temp=%%a"
call set "temp=%%temp:a=b%%"
call echo %%temp%%
)
pause
Code: Select all
@echo off &setlocal
FOR /R %%D in (.) DO CALL :recursive2 "%%D"
GOTO :eof
:recursive2
FOR %%F IN (%~1\*.tga) DO composite -compose Dst_over -tile pattern:checkerboard -size 10x10 "%%F" "%%~nF.png"
montage *.png -background "transparent" -type TrueColorMatte -geometry 120x120+4+4 -tile 4x3 Grid.png
FOR /f "delims=" %%a IN ('dir /a-d /b *.tga') DO CALL :recursive3 %1 "%%a"
del *.png
del *.tga
GOTO :eof
:recursive3
setlocal
FOR /f "delims=- tokens=1*" %%I in ("%~n2") do set "number=%%J"
IF NOT DEFINED number (
GOTO uBound12
) ELSE (
GOTO lBound13
)
:uBound12
convert e:\img_output\IM_RSRC\Header.tga %~2 -append ^
e:\img_output\IM_RSRC\Backdrop.tga +swap -composite ^
e:\img_output\IM_RSRC\Copyright_Grid.tga -composite ^
%~1\%~nx1Sheet.tga
endlocal
GOTO :eof
:lBound13
convert e:\img_output\IM_RSRC\Header.tga %~2 -append ^
e:\img_output\IM_RSRC\Backdrop.tga +swap -composite ^
e:\img_output\IM_RSRC\Copyright_Grid.tga -composite ^
%~1\%~nx1Sheet-%number%.tga
endlocal
GOTO :eof