Making batch which generate previews (everything is fine with this part of code) and also rename files deleting everything after "_" in filename. For example ABAB_abab.png > ABAB.png My code does not see a variable yy in the string: set zz=!xx:yy=! Perceives it like just two letters yy, not a variable. How to fix that?
Here is the script
setlocal enabledelayedexpansion
for %%a in ("*.png") do (
set xx=%%~na
set yy=_!xx:*_=!
set zz=!xx:yy=!
echo xx= !xx! @rem (okay, returns ABAB_abab)
echo yy= !yy! @rem (okay, returns _abab)
echo zz= !zz! @rem (wrong, returns ABAB_abab without any substitutions)
pause
)
endlocal
Thank you for help