Execute a line based on .ext with .bat Batch File? [duplicate]

You can try if() else if() else if ()...

@echo off

cd /d "%~dp0"

if exist 01.png (
         command 
       ) else if exist 01.jpg (
         command
       ) else if exist 01.webp (
         command
       )

If you need, you can add an else to handle the nonexistence of your files...

@echo off

cd /d "%~dp0"

if exist 01.png (
         command
       ) else if exist 01.jpg (
         command
       ) else if exist 01.webp (
         command
       ) else echo file not exist
  • Some further reading: If /?