Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Help Need in batch script

19 Oct 2015   #1
born2achieve

windows7 64 bit
 
 
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 System SpecsSystem Spec
.
20 Oct 2015   #2
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

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 System SpecsSystem Spec
20 Oct 2015   #3
born2achieve

windows7 64 bit
 
 

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
My System SpecsSystem Spec
.

Reply

 Help Need in batch script




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Help Needed in Batch Script
Hi, I have 1000 image url in my text file(sample.txt) and i want to download the images using the url. Can anyone please share with me the sample script which can do this in single shot. Also, is there any way to reduce the size of the image into 20/20 px with png extension. Thanks
General Discussion
W10 TP : Old Windows Update Batch/Script
Hi, I need you for obtain a batch for apply this custom : Retrouvez votre bon vieux Windows Update sous Windows 10 - Le comptoir du hardware Can you help me ? Thanks Have a good day !
Windows Updates & Activation
How to run cmd.exe elevated in batch script
Hi All, I am writing a dos batch file for windows7 and it has many commands which need elevated access to run. For elevation I am using elevate.exe. I am doing like below - set Elevation=elevate -wait cmd.exe /c %Elevation% "cd /d %CD% && xcopy /E /Y ...." %Elevation% "cd /d %CD% &&...
General Discussion
batch script help
dear all any help to make batch script this the reason i want to make a batch file is to help me update the online games in 60 computers by overwriting or copying big files in one click from 1 source computer... instead of turning on all 60 computers and updating all online games, he'll just...
General Discussion
Admin privileges in batch script
Hallo, I wrote a Script that uninstalls an application, move some files and install an Application. The Script is working if I start it as Admin (right click - run as Admin ...). Everything works fine. But I want to have it working without the "run as". The script is only used in a...
Software
Help me with Batch script!
Hi, Can somebody assist me with a .bat file I am trying to create? This is what I have now: start /d "C:\Users\Me\Desktop\ghost" ghost.exe start /d "C:\Users\Me\Desktop" Poweroff.exe C:\Windows\System32\powercfg.exe /setactive e428f8a5-615e-488f-b7f7-1ed39450e522The first 2 lines start...
Software


Our Sites

Site Links

About Us

Find 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 15:29.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App