VBScript to get file from FTP Server to Local Machine

Advertisement

palakksa
Joined:
Posts:
1
Location:
Mumbai

VBScript to get file from FTP Server to Local Machine

Hello,
Can anybody pls give me a VBScript to connect to FTP Server and download files using WinSCP3. I need this whole process to be auomatic without any manual intervention. I tried using the following given on the Website. I wrote this to a text file example.txt

# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open user:password@example.com
# Connect
open user@example.com
# Change remote directory
cd /home/user
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
get examplefile.txt d:\
# Disconnect
close
# Exit WinSCP
exit

Thereafter on the Command prompt i called it using:
winscp3.exe /console /script=example.txt user@example.com

This opens the Winscp GUI Console. But i need to connect to the FTP Server and download the file silently instead of calling the GUI and needing to enter the login details. I need the whole thing to run from VBScript without any manual intervention and get the file to local machine. Is there a different way to do this from command line on Windows or do we need some other setup. I am completely new to this and vbscript. PLas help me out.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: VBScript to get file from FTP Server to Local Machine

First, the "open user@example.com" and "user@example.com" on command-line does the same thing. Hence you end up with two connections opened.

If I understand you correctly your only concern is that there is a console window opened while the script is running. To avoid that, just omit the /console command-line parameter.

Reply with quote

Advertisement

You can post new topics in this forum