title: Move files of multiple extensions in a loop using batch
body: <p>I want some files of specific extensions to move to a destination directory. Here is the portion of my batch file:</p>
  
  <pre><code>move "%filepath%\*.txt" "%~dp0"
  move "%filepath%\*.docx" "%~dp0"
  move "%filepath%\*.pdf" "%~dp0"
  move "%filepath%\*.jpg" "%~dp0"
  move "%filepath%\*.png" "%~dp0"
  </code></pre>
  
  <p>The above code works fine. But I want to do so in a loop. I am trying like the following:</p>
  
  <pre><code>set f_ext=*.txt *.docx *.pdf *.jpg *.png
  for %%f in (%f_ext%) do (
      move "%filepath%\%%f" "%~dp0"
  )
  </code></pre>
  
  <p>The above code works only if there are already the files of same names in the destination folder (<code>%~dp0</code>), but it does not work otherwise.</p>
  
  <p>So how to move files of some extensions in a loop using batch that does not require the filenames exist in the destination folder?</p>