I know there is a lot of this topic, but my case I can not put two steps as one. Basically I tried to search txt files end with *_debug_remove.txt then
Code: Select all
@echo off
if exist foundfn.txt (del foundfn.txt)
for %%F in ("C:\Users\abcd\*_debug_remove.txt") do echo %%~nxF>>foundfn.txt
I also want to output TAS as a variable since the above TAS_debug_remove.txt can be any like AAAbbb_debug_remove.txt .....
Now I tried this code, but not working, why?
Code: Select all
@echo off
if exist foundfn.txt (del foundfn.txt)
for %%F in ("C:\Users\abcd\*_debug_remove.txt") do (
set var=%%~nxF
set var=%var:~0,-17%
echo %var%>>foundfn.txt
)