title: Escape PIPE character in a function call windows Batch script
body: <p>I am writing a function to execute shell commands and capture its output in a batch script.</p>
  
  <pre><code>:runShellCmd
     setlocal EnableDelayedExpansion
     SET lf=-
     FOR /F "delims=" %%i IN ('%~1') DO if "%out%" == "" (set out=%%i) else (set out=!out!%lf%%%i)
     echo "Cmd output: %out%"
     SET "funOut=%out%"
  ENDLOCAL &amp; IF "%~1" NEQ "" SET %~2=%out%
  goto :EOF
  </code></pre>
  
  <p>I have been successful in passing simple commands and getting output. But for calls like</p>
  
  <p><code>CALL :runShellCmd "echo Jatin Kumar | find /c /i "jatin""</code> it fails with error <code>unexpected | character</code>.</p>
  
  <p>I know we need to escape <code>|</code> with <code>^</code> in for but if I try to pass <code>^|</code> in the function argument string, it changes it to <code>^^|</code> which again throws error.</p>
  
  <p>Am I missing something? </p>