title: Batch file for FTP multiple file upload
body: <p>I want to create a batch file to execute below commands - </p>
  
  <ol>
  <li>cd to the directory whose content i want to upload.</li>
  <li>log into the Ftp with Host name + userid &amp; pswd</li>
  <li>Cd to the directory [in server] where you want to upload the files.</li>
  <li>mput *.txt</li>
  </ol>
  
  <p>I am able to run these steps and transferred all the files to server location manually. </p>
  
  <p>But now i want to automate the process, below is code of my batch file..but its giving error Invalid command - even though i have added linebreak after usernamevalue. i referred to <a href="https://stackoverflow.com/questions/936108/how-to-script-ftp-upload-and-download">How to script FTP upload and download?</a></p>
  
  <p>i use below script - and its says "password required for user1" although i have given password</p>
  
  <pre><code>    @echo off
      echo user user1&gt; ftpcmd.dat
      echo mypassword&gt;&gt; ftpcmd.dat
      echo quit&gt;&gt; ftpcmd.dat
      ftp -n -s:ftpcmd.dat myservername
      del ftpcmd.dat
      pause
  </code></pre>
  
  <p>also first i have to change the directory to the location from where i am picking all the files [source folder of my files]</p>
  
  <p>Something like 
          CD c:\MySource</p>