title: Batch script issues when copying files
body: <p>I'm having an issue and I have been working on it for hours. I have no idea why it wont work, but I have a feeling it has to do with doing a for loop in a for loop. Its going to be a little difficult to explain. So here goes:</p>
  
  <p>I have this code that works. What it does is copy 3 files from programdata to appdata. We need the "for loop" because the profile %var% is always different in that folder. It will find the name and input it to "cd" into. </p>
  
  <pre><code>Echo Restore Firefox Files
  
  set copycmd=/y
  timeout 7
  c:
  cd "%userprofile%\AppData\Roaming\Mozilla\Firefox\"
  for /f "tokens=1,2 delims=/" %%i in ('findstr /l ".default" profiles.ini') do call set var1=%%j
  cd profiles\%var1%
  if exist "C:\Programdata\TLCloud\BrowserBackup\Username\MozillaRoaming\Firefox\Profiles\%var1%\places.sqlite" copy "C:\Programdata\TLCloud\BrowserBackup\Username\MozillaRoaming\Firefox\Profiles\%var1%\places.sqlite"
  if exist "C:\Programdata\TLCloud\BrowserBackup\Username\MozillaRoaming\Firefox\Profiles\%var1%\key3.db" copy "C:\Programdata\TLCloud\BrowserBackup\Username\MozillaRoaming\Firefox\Profiles\%var1%\key3.db"
  if exist "C:\Programdata\TLCloud\BrowserBackup\Username\MozillaRoaming\Firefox\Profiles\%var1%\signons.sqlite" copy "C:\Programdata\TLCloud\BrowserBackup\Username\MozillaRoaming\Firefox\Profiles\%var1%\signons.sqlite"
  </code></pre>
  
  <p>The point is, that code works. It copys from where i want it to. Here's my issue. I have this code. It will not work. Note the main loop starts where it says "Echo Loop through each user and copy files".</p>
  
  <pre><code>Echo Set Usernames into Variables (User1, User2, etc)
  for /F "tokens=*" %%A in (C:\ProgramData\TLCloud\WindowsUsers.txt) do (
      SET /A vidx=!vidx! + 1
      set user!vidx!=%%A
      set /A i = !i! + 1
  )
  
  Echo Put Usernames into an Array
  set i=0
  for /f "delims=" %%a in (C:\ProgramData\TLCloud\WindowsUsers.txt) do (
      set /A i+=1
      set list[!i!]=%%a
  )
  
  Echo Loop Through Each User and Copy Files
  for /F "tokens=2 delims==" %%s in ('set list[') do (
      If NOT "%%s" == "Guest" (
          If NOT "%%s" == "Administrator" (
  
  Echo Restore Firefox Files
  
  set copycmd=/y
  ::start "browser" /d "C:\Program Files (x86)\Mozilla Firefox" firefox.exe
  timeout 7
  c:
  cd "%userprofile%\AppData\Roaming\Mozilla\Firefox\"
  for /f "tokens=1,2 delims=/" %%i in ('findstr /l ".default" profiles.ini') do call set var1=%%j
  cd profiles\%var1%
  if exist "C:\Programdata\TLCloud\BrowserBackup\Username\MozillaRoaming\Firefox\Profiles\%var1%\places.sqlite" copy "C:\Programdata\TLCloud\BrowserBackup\Username\MozillaRoaming\Firefox\Profiles\%var1%\places.sqlite"
  if exist "C:\Programdata\TLCloud\BrowserBackup\Username\MozillaRoaming\Firefox\Profiles\%var1%\key3.db" copy "C:\Programdata\TLCloud\BrowserBackup\Username\MozillaRoaming\Firefox\Profiles\%var1%\key3.db"
  if exist "C:\Programdata\TLCloud\BrowserBackup\Username\MozillaRoaming\Firefox\Profiles\%var1%\signons.sqlite" copy "C:\Programdata\TLCloud\BrowserBackup\Username\MozillaRoaming\Firefox\Profiles\%var1%\signons.sqlite"
  
  )
  )
  )
  </code></pre>
  
  <p>Why will this code not work? Ignore the variables and array code, that is there so instead of "Username" I can eventually use "%%s" as the variable for changing usernames. But there is no reason this should not work, or am I not allowed to have a for loop in another for loop? </p>
  
  <p>Any help is greatly appreciated. </p>