Help Need in batch script

born2achieve

New member
Local time
7:08 AM
Messages
36
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

Computer type
PC/Desktop
OS
windows7 64 bit
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:[email protected]/
lcd C:\Download\ftp\files\here
get OneFile.txt
get Multiple.txt Files.txt .\
get “*ALotOfFiles*.*” .\
exit
 

My Computer

Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
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:

My Computer

Computer type
PC/Desktop
OS
windows7 64 bit
Back
Top