I have a loop that loops over files, gets the actual file name (not including the whole path) and tries to check if that file name exists in some list. the code I have is:
setlocal enabledelayedexpansion enableextensions
for /R %%j in (*.c) do (
set MYVAR=%%j
set actualFileName=%%~nj
if NOT "%MY_FILE_LIST%"=="!MY_FILE_LIST:%actualFileName%=!" set "TOCOMPILE=!TOCOMPILE! %MYVAR%"
this code does not work since the actualFileName is accessed with % instead of !. but !MYVAR:~!actualFileName!! doesn't work either. what can i do?