Post by Scott BryantCan someone please tell me where I can find some useful
information on how to retrieve a file via ftp in a
vbscript? I've found countless articles about msinet.ocx,
but not much on how to use it. i'm having to go through a
proxy server to get the file.
Hi
You can run ftp.exe from command line/batch/vbscript, using an input file
with -s:
http://groups.google.com/groups?th=dc0c0f2ec58712ff
http://groups.google.com/groups?th=d4a8746457a4297f
If you want more control, take a look at the components below.
They wrap WinInet.dll in a object you can use from a VBScript:
1)
AspFTP (free)
http://www.15seconds.com/issue/981203.htm
Download 981203.zip and unpack it. Register the dll aspftp.dll:
regsvr32.exe "<some path>\aspftp.dll"
(if you want to register it unattended, use regsvr32.exe /s ....)
you can then connect to the object like this:
Set oFTP = CreateObject("NIBLACK.ASPFTP")
See AspFTP2_Doc.htm in the zip file for documentation and e.g. AspFTP2_Get.asp
and AspFTP2_Put.asp for examples.
An example here as well:
http://groups.google.com/groups?selm=tKWmLfM5DHA.4028%40cpmsftngxa07.phx.gbl
2)
AspInet (free)
http://www.serverobjects.com/comp/AspInet.zip
Download AspInet.zip and unpack it. Register the dll ASPINET.DLL:
regsvr32.exe "<some path>\ASPINET.DLL"
(if you want to register it unattended, use regsvr32.exe /s ....)
you can then connect to the object like this:
Set oFTP = CreateObject("AspInet.FTP")
See InetAsp.doc in the zip file for documentation and InetFtp.asp for examples
An example here as well:
http://groups.google.com/groups?selm=tKWmLfM5DHA.4028%40cpmsftngxa07.phx.gbl
3)
Ian Morrish's FAQ at http://groups.msn.com/WindowsScript/othercomobjects.msnw
- Free FTP COM Object & sample script
To use the example in the link above, you
need to run the exe file vbInet.exe that is inside the zip file vbInet.zip once
(it is a self registering exe file). vbInet.exe is a component that wraps the
API's so you can use it from a vbscript.
After you have run vbInet.exe, you can connect to the object like this:
Set oInet = WScript.CreateObject("VBInet.CNetUpload","oInet_")
--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter