0

I have this code which works perfectly,

    :process_video

FOR /F "delims=\" %%i IN ('dir /b /ad-h /o-d') DO (
    SET a=%%i
    GOTO :found
)
echo No subfolder found
goto :eof

:found
echo Most recent video created: &echo. & echo."%a%"
if  /i "%a:~-3%"=="ESP" 
else if  /i "%a:~-3%"=="GBR" goto:next
cd %a%
for %%a in (*) do rename "%%a" "%%~na-%a%%%~xa"
cd ..\
ren "%a%" "%a% - ESP"
echo.
echo ESP video has been processed
echo.
pause
exit /b

:next
echo.
echo.ESP Video already processed
echo.
pause

:exit
exit /b

However I would like to expand the check criteria not only just ESP, but other words.

I tried this, but with not luck:

if  /i "%a:~-3%"=="ESP", 
else if /i "%a:~-3%"=="GBR", 
else if/i "%a:~-3%"=="SPE" goto:next

ANd this

echo Most recent video created: &echo. & echo."%a%"
if /i "%a:~-3%"=="ESP" ( 
goto:next 
) else if /i "%a:~-3%"=="GBR" 
(
goto:next 
) else if /i "%a:~-3%"=="SPE"
(
goto:next
)
else
)
echo THis works 
)

I thought it would be an else if?

I am not sure what I am missing here.

Update:

:found
echo Most recent video created: &echo. & echo."%a%"
if /i "%a:~-3%"=="ESP" goto:next else goto:GBR
:GBR
if /i "%a:~-3%"=="GBR" goto:next else goto:SPE
:SPE
if /i "%a:~-3%"=="SPE" goto:next 

This works, however, for me it is not clean, why is the else if not working,

Thanks

Arthor
  • 666
  • 2
  • 13
  • 40

1 Answers1

1

If you want an OR with the text then this will work.

for %%a in (ESP GBR SPE) do if  /i "%a:~-3%"=="%%a" goto:next

Here is a proof of concept

@echo off
set a=123456.GBR
for %%a in (ESP GBR SPE) do if  /i "%a:~-3%"=="%%a" echo goto:next & pause
foxidrive
  • 40,353
  • 10
  • 53
  • 68
  • I have just tried the code, but I am a little confused. The folder can either have ESP, GBR or SPE at the end of it, but never all 3, e.g, `Folder - ESP, Folder - GBR, Folder - SPE`. I have tried the above code however it does not work as a folder with `- GBR` is still processed. – Arthor Jun 30 '14 at 13:37
  • I don't know what you expect the code to do now. See my edited code above with an example that works. – foxidrive Jun 30 '14 at 15:47
  • I have tried however if the folder is `test - GBR` the folder is processed. So it does not SKIP the process. I have published the entire code. – Arthor Jun 30 '14 at 21:24
  • @foidrive I have tried this, `echo Most recent video created: &echo. & echo."%a%" if /i "%a:~-3%"=="ESP" ( goto:next ) else if /i "%a:~-3%"=="GBR" ( goto:next ) else if /i "%a:~-3%"=="SPE" ( goto:next ) else ) echo THis works )` No joy – Arthor Jun 30 '14 at 22:18