<p>If I am iterating over each file using :</p>

<pre><code>@echo off

FOR %%f IN (*\*.\**) DO (
    echo %%f
)
</code></pre>

<p>how could I print the extension of each file? I tried assigning %%f to a temporary variable, and then using the code : <code>echo "%t:~-3%"</code> to print but with no success.</p>

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!