title: DOS script tp FTP from a remote server and copy files to local folder
body: <p>I need to write a single dos script which will first FTP from a remote server to my local directory and then will copy these files to another folder within the local machine. The reason behind the second step is that the destination folder path is based on whether the SYSTEM Processor of 32-bit or 64-bit.</p>
  
  <p>I have two separate scripts which are working fine now. But when I am putting them together in a single script, it is failing with the ftp command prompt. Here is the script which I am using -</p>
  
  <pre><code>@echo off
  :MAIN
  
  SETLOCAL ENABLEDELAYEDEXPANSION
  
  
  set winver=%PROCESSOR_ARCHITECTURE%
  
  rmdir c:\batch\temp
  
  mkdir c:\batch\temp
  
  goto :ftpbegin
  
  :ftpbegin
  
  @ftp -i -s:"%~f0"&amp;GOTO:EOF
  open x.y.z.a
  &lt;userid&gt;
  &lt;password&gt;
  !:-----FTP commands here -----
  lcd C:\batch\temp
  cd CGServices\Uploads
  binary
  mget "*.psl"
  mget "*.PST"
  mget "*.psy"
  get abc.ini
  get def.pmd
  disconnect
  bye
  
  :eof
  
  exit /b
  
  
  :findwin
  
  if %winver% ==x86 (goto :copywin32) else (goto :copywin64)
  
  
  :copywin32
  
  echo "inside copywin32"
  
  &lt;do the copy files here&gt;
  
  :copywin64
  &lt;do copy files here&gt;
  
  exit /b 0
  </code></pre>
  
  <p>However, the ftp script seems to cause a break while executing the second part of my program since it is calling the program in a loop in ftp prompt. So, none of the dos commands are translated on FTP prompt. </p>
  
  <p>Any help on how to achieve this in a single script for this is highly appreciated.</p>
  
  <p>thanks,
  Sanders</p>