title: Why does a batch file working before not work anymore as expected on some machines?
body: <p>I have a batch script already working for some months. The purpose of the script is to  create a folder based on the file name and rename the folder accordingly for a certain purpose. However, it stops moving the files to the created folder in the loop. I tested it on other machine and it was working fine, but on a particular machine; it is just not working.</p>
  
  <p>What can I do to make the loop effective and why did the batch stop working (moving files to folder) after working for many months now?</p>
  
  <pre><code>setlocal EnableDelayedExpansion
  
  for /F %%a in ('dir "C:\Program Files\WinSCP\Unconverted" /a-d /b') do (
      if not "%%~dpnxa"=="%~dpnx0" call :func "%%~a"
  
  :func
  set file=%~1
  set dir=%file:~0,49%
  mkdir "C:\Program Files\WinSCP\Unconverted\%dir%_fdc" 2&gt;nul
  
  rem ECHO "%file%"
  rem ECHO "C:\Program Files\WinSCP\Unconverted\%dir%_fdc" 
  
  move /Y "C:\Program Files\WinSCP\Unconverted\%file%" "C:\Program Files\WinSCP\Unconverted\%dir%_fdc"  
  )
  
  start "" "C:\Program Files\WinSCP\hide_conversion_window.exe"
  </code></pre>