I try to extract the filename from a list of files, replace specific string and feed that into a process. However I got stuck at replace. Any idea?
@echo on
setlocal ENABLEDELAYEDEXPANSION
for %%f in (*.txt) do (
REM echo %%~nf
set filename=%%~nf
echo %@filename%
set Replaced=replaced
set @ver=!%filename:ToBeReplace=%Replaced%!
echo %@ver%
)
The echo from ver is not what I expected. Thanks in advance!
!instead of%you can combine it with%when you are replaceing a string -set @ver=!filename:ToBeReplace=%Replaced%!if %replaced% is defined before the brackets block