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

5
  • Try this: stackoverflow.com/questions/11081735/… Commented Jun 30, 2014 at 11:42
  • @AndiMohr Thanks Andi, but not joy. I tried it. But not joy. This is one of this first things I tried, looked up other posts. Commented Jun 30, 2014 at 11:46
  • Hm ok - did you see this post? Might be more useful as the top answer deals with FOR/DO loops: stackoverflow.com/a/8439069/1607446 Commented Jun 30, 2014 at 11:55
  • @AndiMohr I shall give it a try. Thanks Commented Jun 30, 2014 at 12:12
  • @AndiMohr I found a solution, please have a look. Thanks Commented Jun 30, 2014 at 22:52

1 Answer 1

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 
Sign up to request clarification or add additional context in comments.

4 Comments

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.
I don't know what you expect the code to do now. See my edited code above with an example that works.
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.
@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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.