I am using Windows 11 and have a simple renaming script that I’m trying to simplify but can’t figure out how to use wildcards in the variable.
SETLOCAL EnableExtensions DisableDelayedExpansion
pushd "."
FOR /f "delims=" %%G IN ('dir /a-d /b /s /o-n') DO (
SET "_FFN=%%~fG" File Full Name
SET "Var=%%~nxG" File Name + Extension
call :renaming
)
popd
ENDLOCAL
goto :EOF
:renaming
SET "Var=%Var:{????}=(????)%"
rename "%_FFN%" "%Var%"
If I set the variable to SET "Var=%Var:{1234}=(1234)%" it works fine however I’d like it to work on any string it finds that contains {????} but it doesn’t work this way with wildcards.