Friday, May 2, 2008

Using FTP in VB.net

A easy way to use ftp in vb.net is to call Windows ftp.exe.

First, you need to create a txt file with all the ftp commands.

An example ftp.txt:

open hostname portnumber
username
password
put filename
bye
exit


Then, in your vb.net script, use Shell to call ftp.exe:

ProcID = Shell("ftp -s:ftp.txt")

2 comments:

infodemers said...

Would you know how I can get a capture screen of the FTP session to a text file using your method?

Thanks!

LISHA LI said...

Hi infodemers,

I am a little confuse of your question. In my method, first,I create a ftp.txt file which is saved in hard disk and includes all the scripting. And then, use Shell to call ftp.exe to execute those scripting.
You can find ftp.exe at c:\windows\system32 directory.