Question: I want to do some stuffs on images with extensions defined in a variable.
The following script run well:

```
set AllowExt="jpg png bmp"
forfiles /p D:\Pictures /m *.* /c "cmd /c if not %AllowExt:jpg=% == %AllowExt% echo @file

```

But the following script throws error

```
set AllowExt="jpg png bmp"
forfiles /p D:\Pictures /m *.* /c "cmd /c if not %AllowExt:@ext=% == %AllowExt% echo @file"

```

ERROR: Invalid argument/option - 'png'.
Type "FORFILES /?" for usage.

Answer: 
You might try this:

```
set "AllowExt=.jpg .png .bmp"
for %%a in (%AllowExt%) do (
  forfiles /p D:\Pictures /m *%%a /c "cmd /c echo @file"
)

```

`"cmd /c echo @file"` is the default command, see `forfiles /?`.
This should get you the filenames you need.

```
@echo off
set "AllowExt=jpg png bmp"
set "AllowExt= %AllowExt%"
set "AllowExt=%AllowExt: = *.%"
  pushd "D:\Pictures"
   for %%a in (%AllowExt%) do (
     echo "%%a"
   )
  popd

```