title: Escape asterisk in Windows Batch File's FOR Loop
body: <p>When running the following code in a windows batch file everything works aside from the string containing the asterisk, which is skipped.  Checking the passed parameters by number (i.e. <code>echo(%~6</code>) I can see the asterisk - it's only when passed to the FOR loop that I have an issue:</p>
  
  <pre><code>@echo off
  setlocal enableextensions enabledelayedexpansion
  call:Concat cmd "this is a demo" " of concat functionality." " Hopefully it will work;" " but it doesn't when I pass an" " * asterisk" " character"
  echo !cmd!
  
  @goto:end
  @goto:eof
  
  
  :Concat
  ::Concatenates a given list of strings without including their quotes
  ::1 - output variable
  ::2* - strings to concat
  echo(%*
  set /a xx=0
  set Concat_tempFlag=0
  set Concat_temp=
  for %%A in (%*) do (
      set /a xx=!xx!+1
      echo !xx! - %%A
      if !Concat_tempFlag!==1 (
          set Concat_temp=!Concat_temp!%%~A
      ) else (
          set Concat_tempFlag=1
      )
  )
  set "%~1="%Concat_temp%""
  @goto:eof
  
  :End
  echo(Bye
  exit /b 0
  </code></pre>
  
  <p>I've attempted <code>for /F (tokens=*) %%A in ('echo(%*') do (</code> as suggested here: <a href="https://stackoverflow.com/questions/13609760/batch-for-loop-with-asterisk">Batch FOR loop with asterisk</a> (and variations thereof) but with no luck.  Any ideas?  Thanks in advance.</p>