title: What is the syntax error in this batch script?
body: <p>I am trying to get a substring from a string and check if it is equal to "System". I am getting the string from %%a. When I run the script I get the error "unexpected (". If I remove the lines inside the for loop ("set _varsub ...) the error goes away. So I think there is some syntax error with my substring command. Can anyone tell me?</p>
  
  <pre><code>  for /f "tokens=1,3,4,* delims=: " %%a in ('e:\DeployTools\handle.exe %deploymentdir%\%%i ^| findstr /i pid: ')  do @(
  
  
          set _varsub=%%a
          set _varsub=%_varsub:~0,6%
          if not %_varsubstring%==System (
  
          // do something
        )
  </code></pre>