title: Interate Using Plink and PSCP
body: <p>I am trying to iterate to various different Linux servers and scp the .cer files to a windows computer. I need to create a folder based on the var that is returned and then scp the file to that location.
  There seems to be something wrong with the For /F loop where it is creating each folder but it is only doing the scp copy to the first assignment of the variable. i.e all files go to the first folder created.
  Do I need to clear the variable each time - I am new to batch scripting. Thanks for your help.</p>
  <pre><code>REM @echo off
  FOR /F %%A IN (addresses.txt) DO (
  @echo %%A
  FOR /F &quot;tokens=* USEBACKQ&quot; %%F IN (`plink -pw &quot;password&quot; &quot;root@%%A&quot; -m cmds.txt`) DO (
  @echo %%F
  SET var=%%F
  mkdir c:\temp\certfiles\%%F
  pscp -pw password -P 22 root@%%A:/Certificates/*.cer c:\temp\certfiles\%var%\
  )
  )
  </code></pre>