Help Need in batch script


  1. Posts : 36
    windows7 64 bit
       #1

    Help Need in batch script


    Hi,

    I have my vendor's ftp url over SSL. it's like ftps://myvendor.com and i have username and password. So please help me on writing batch script t o downlod the file from my vendor repository.
    If this is not possible in dos script, please suggest me opensource tool. But i would love the solution in dos script as i need to use this forever to avoid any manual work.

    Thanks
      My Computer


  2. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #2

    Hi Born2achieve,

    The FTP client that ships with Windows does not support SFTP (SSH File Transfer Protocol) protocol. You’ll need to download a 3rd party SFTP supported FTP client that has a command line interface if you wish to engage with your vendor’s FTP server using Batch.

    I highly recommend WinSCP. They offer a portable executable in case you don’t want to install any thing.

    To get you started, the script for the WinSCP part would look something like,
    Code:
    open sftp://MyUsername:MyPassword@sftp.MyVendor.com/
    lcd C:\Download\ftp\files\here
    get OneFile.txt
    get Multiple.txt Files.txt .\
    get “*ALotOfFiles*.*” .\
    exit
      My Computer


  3. Posts : 36
    windows7 64 bit
    Thread Starter
       #3

    Hi Pyprohly,

    thanks for your reply. Here is my try

    I tried to make below code with the file name as "connection.txt"

    Code:
    # Automatically abort script on errors
    option batch abort
    # Disable overwrite confirmations that conflict with the previous
    option confirm off
    # Connect with username and password
    open sftp://username:pwd: https://ftps.domain.com/
    # Change local directory
    lcd D:\Test\FTPS\
    # Force binary mode transfer
    option transfer binary
    # Download missing files to local directory from remote
    get “*.*” .\
    # Disconnect
    close
    # Exit WinSCP
    exit

    in the place of username,pwd,url i supplied my actual values. Also i am trying to download all the file as a test and used *.* ./

    Then i called the winscp exe using below code
    Code:
    D:\Test\winscp570\WinSCP.exe /console /script="D:\Test\winscp570\connection.txt" /log="D:\Test\winscp570\conn.log"
    Is there anything am doing wrong? please help me on giving the workable script.

    Thanks
    Last edited by born2achieve; 20 Oct 2015 at 17:10.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 11:52.
Find Us