If I am iterating over each file using :
@echo off
FOR %%f IN (*\*.\**) DO (
echo %%f
)
how could I print the extension of each file? I tried assigning %%f to a temporary variable, and then using the code : echo "%t:~-3%"
to print but with no success.
The FOR command has several built-in switches that allow you to modify file names. Try the following:
@echo off
for %%i in (*.*) do echo "%%~xi"
For further details, use help for
to get a complete list of the modifiers - there are quite a few!