I have a small batch script:
@echo off
cls
setlocal enabledelayedexpansion
SET BINARY_FILES=find_files.cmd;find_files2.cmd
pushd "%cd%"
call :listFiles
popd
goto :eof
:listFiles
for /R "%cd%" %%i in ( *.cmd ) do (
set "filen=%%~nxi"
rem give me only the filename
call :checkIfIsList !filen!
)
goto :eof
:checkIfIsList
set "FILETOCHECK=%1"
echo "FILETOCHECK: !FILETOCHECK!"
echo "Output: %BINARY_FILES:!FILETOCHECK!=%"
goto :eof
The output of this script is something like this one:
"FILETOCHECK: findstring.cmd"
"Output: find_files.cmd;find_files2.cmd"
"FILETOCHECK: find_files.cmd"
"Output: find_files.cmd;find_files2.cmd"
"FILETOCHECK: find_files2.cmd"
"Output: find_files.cmd;find_files2.cmd"
"FILETOCHECK: first.cmd"
"Output: find_files.cmd;find_files2.cmd"
The problem is: I want, that the second line which starts with "Output: ..." has only this output
"Output: ;find_files2.cmd"
Why does the string replacement not work?