title: Findstr too slow on UNC batch script
body: <p>I am running a script that goes through network folders and saves the found files, however it is taking too long to run. I have tried isolating the findstr to a single folder and it runs at an okay time, so I assume it has something to do with the FOR loop.</p>
  <pre><code>@echo off
  
  setlocal
  
  set SERVERS=server1 server2 server3 server4
  
  cls
  echo Type below the query parameters:
  set /p year=Year (4 digits): 
  set /p month=Month (2 digits): 
  set /p day=Day (2 digits): 
  set /p query=Query string: 
  cls
  echo Results:
  del /F /Q &quot;C:\Users\%USERNAME%\Desktop\found_files\*&quot; 2&gt;nul
  if not exist &quot;C:\Users\%USERNAME%\Desktop\found_files&quot; mkdir &quot;C:\Users\%USERNAME%\Desktop\found_files&quot;
  for /f &quot;tokens=*&quot; %%a in ('for %%i in ^(%SERVERS%^) do @findstr /S /I /M /C:&quot;%query%&quot; &quot;\\%%i\folder_structure\*%year%-%month%-%day%*.xml&quot;') do copy /Y &quot;%%a&quot; &quot;C:\Users\%USERNAME%\Desktop\found_files&quot; &gt;nul &amp; echo %%a &amp; set found=1
  echo.
  if &quot;%found%&quot;==&quot;1&quot; (
      echo File^(s^) saved successfully!
  ) else (
      echo No files found!
  )
  echo.
  pause
  if &quot;%found%&quot;==&quot;1&quot; explorer C:\Users\%USERNAME%\Desktop\found_files
  </code></pre>