Exclamation Points are my bane with Windows Batch. Say I want to just skip filenames with an !
in them.
I know for checking regular text in variables in a for loop, I can run:
setlocal enabledelayedexpansionfor /r %%a in (*) do (set fname=%%~naif not "!fname!"=="!fname:text=!" ECHO File contains the word "text")
But how do I specify an exclamation point?
I've tried to escape it with ^: "!fname:^!=!"
Then I see that with enabledelayedexpansion you need a ^^!
to escape the character. So I tried that with no luck. Then I thought maybe three ^^^!
two to escape delayedexpansion and one in the filename...
No luck...
Any suggestions?