title: Batch file: Extracting substring from input parameter to use in IF statement
body: <p>This is a very basic example of what I am trying to implement in a more complex batch file. I would like to extract a substring from an input parameter (<code>%1</code>) and branch based on if the substring was found or not. </p>
  
  <pre><code>@echo off
  SETLOCAL enableextensions enabledelayedexpansion
  
  SET _testvariable=%1
  SET _testvariable=%_testvariable:~4,3%
  
  ECHO %_testvariable%
  
  IF %_testvariable%=act CALL :SOME
  IF NOT %_testvariable%=act CALL :ACTION
  
  :SOME
  ECHO Substring found
  GOTO :END
  
  :ACTION
  ECHO Substring not found
  GOTO :END
  ENDLOCAL
  
  :END
  </code></pre>
  
  <hr>
  
  <p>This is what my output looks like:</p>
  
  <pre><code>C:\&gt;test someaction
  
  act
  
  =act was unexpected at this time.
  </code></pre>
  
  <hr>
  
  <p>If possible I would like to turn this in to a IF/ELSE statement and evaluate directly from <code>%1</code>. However I have not had success with either. </p>