title: windows batch parentheses scope
body: <p>How can I set result variable in a scope surrounded with parantheses ('if' or 'for'-loop). The result is correct (>> RESULT: aaa = bbb), when procedure is called directly, and fails when used in for-loop or if-statement (>> RESULT: ccc = ).</p>
  
  <pre><code>:: =====================================
  @setlocal
  @echo off
  @rem (1)
  call :testReturn aaa
  echo RESULT: aaa = %aaa%
  
  @rem (2)
  if "1" == "1" (
  call :testReturn ccc
  echo RESULT: ccc = %ccc%
  )
  
  goto :eof
  
  :testReturn
  set %~1=bbb
  exit /b
  endlocal
  </code></pre>
  
  <p>Thanks!!</p>