title: BATCH compare of array within loop doesnt work
body: <p>I'm comparing two folders of pdf files.
  First I check which files are new and save all new files in an array anew:</p>
  
  <pre><code>setlocal enabledelayedexpansion
  FOR /F "delims=. tokens=1" %%I IN ('dir "%Rev2Dir%\*.pdf" /b') DO (
      if not exist "%Rev1Dir%\%%I.pdf" (
          IF NOT EXIST new.txt (
              ECHO %%I new &gt; new.txt
          ) ELSE (
              ECHO %%I new &gt;&gt; new.txt
          )
          ECHO %%I.pdf ^(new^)
          copy "%Rev2Dir%\%%I.pdf" "%Rev1Dir%\%%I.pdf"
          set /A i=i+1
          set anew[!i!]=%%I
      )
  )
  </code></pre>
  
  <p>This works fine. I'm able to display all those files with: </p>
  
  <pre><code>set k=%i%
  for /L %%i in (1,1,%k%) do echo file number %%i: "!anew[%%i]!"
  </code></pre>
  
  <p>Now it's getting tricky.
  Within an other loop, I'm checking whole first folder and need to know if the file is new or not:</p>
  
  <pre><code>FOR /F "delims=. tokens=1" %%I IN ('dir "%Rev1Dir%\*.pdf" /b') DO (
      IF EXIST "%Rev2Dir%\%%I.pdf" (  
          echo file is %%I
          echo j is !j!
          if "%%I" == "!anew[%j%]!" (
              set /A j=j+1
              ECHO %%I.pdf ^(new^)            
          ) Else (
              echo do someting
          )
  
  )
  </code></pre>
  
  <p>The issue is, that !anew[%j%]! is still anew[1]. The variable j will not update.
  For my echo it works fine. So I guess I need something like !anew[!j!]! (which does not work)
  Can someone assist.</p>