Seems like I can use the FOR command recursively to search for wildcards such as
FOR /R %F IN (*.ASM) DO @ECHO %F
This successfully prints out all files with the .ASM extension that exist somewhere within the current directory tree
However, if I'm searching for a specific filename, this doesn't work at all:
FOR /R %F IN (LECTURE3_CODE.ASM) DO @ECHO %F
The output of the latter command seems to print out <path>\LECTURE3_CODE.ASM once for every single file that exists in the working directory tree.
Is there some way to get this command to work the way I want it to?
Very simple:
FOR /R %f IN (*.ASM) DO (if "%~nf"=="LECTURE3_CODE" ECHO %f)
Done!
This will work for your original line - the wildcard is the key here.
FOR /R %F IN (LECTURE3_CODE.AS?) DO @ECHO %F
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With