title: Using calculated variable in windows batch file as command line parameter
body: <p>I'm trying to calculate variable value in FOR loop and then reuse it as command line parameter when calling executable file.
  I managed to calculate the variable, but i can't pass is to exe file</p>
  
  <p>Full code:</p>
  
  <p>SetParameters.bat</p>
  
  <pre><code>SET PAYLOAD_SIZE=1024 
  SET OPERATIONS_COUNT=20
  SET THREADS=8
  SET BULKSIZE=200
  </code></pre>
  
  <p>And the executed bat file</p>
  
  <pre><code>call 0_SetParameters.bat
  SET MAX_EMPLOYEE_ID=0
  setlocal enabledelayedexpansion
  
  FOR %%n IN (1 2 4 8) do (
  @SET /a MAX_EMPLOYEE_ID+=%OPERATIONS_COUNT%
  echo !MAX_EMPLOYEE_ID!
  Launcher.exe -P:%PAYLOAD_SIZE% -O:%OPERATIONS_COUNT% -N:test1 -T:%%n -BULKSIZE:%BULKSIZE% -MAX_EMPLOYEE_ID:%MAX_EMPLOYEE_ID%
  )
  </code></pre>
  
  <p>echo !MAX_EMPLOYEE_ID! - prints calculated value that i need, but when i try to pass parameter to exe file variable is equal 0 (initial variable value).</p>
  
  <p>I also tried</p>
  
  <pre><code>Launcher.exe -P:%PAYLOAD_SIZE% -O:%OPERATIONS_COUNT% -N:test1 -T:%%n -BULKSIZE:%BULKSIZE% -MAX_EMPLOYEE_ID:!MAX_EMPLOYEE_ID!
  </code></pre>
  
  <p>but this passes string "!MAX_EMPLOYEE_ID!" and not the numeric value.
  So how can i use this variable when calling exe file?</p>
  
  <p>UPDATE: 
  Ok, i understood what was happening here. Actually everything worked, executable was called with calculated parameter, but output to console was printing -MAX_EMPLOYEE_ID:!MAX_EMPLOYEE_ID!</p>
  
  <p>So correct way to call executable is</p>
  
  <pre><code>Launcher.exe -P:%PAYLOAD_SIZE% -O:%OPERATIONS_COUNT% -N:test1 -T:%%n -BULKSIZE:%BULKSIZE% -MAX_EMPLOYEE_ID:!MAX_EMPLOYEE_ID!
  </code></pre>