Link to home
Start Free TrialLog in
Avatar of ezjurgen
ezjurgenFlag for Belgium

asked on

VBScript to retrieve, from FTP, Unrar and copy to CLients with Log

Hi, I'm quite new to VBScript (made some logon scripts etc) but I need to shedule a script that will download a RAR archive from an FTP server, unpack it and copy it to several desktops. I now run 4 diff programs who seem to take turns in not working. Therefore I need some log created too..

Can anyone help?


thanks
Avatar of fattumsdad
fattumsdad

You can start with something like this:

Option Explicit
Dim objShell, objShell2
Set objShell = CreateObject("WScript.Shell")
Set objShell2 = CreateObject("WScript.Shell")

objShell.Run "ftp" 'open FTP
Wscript.Sleep 500 'Pause
objShell.SendKeys "open SERVER {ENTER}" 'ftp.whatever.whatever
objShell.SendKeys "USERNAME {ENTER}" 'FTP login name
objShell.SendKeys "PASSWORD {ENTER}" 'FTP password
objShell.SendKeys "get FILENAME" 'Name of the file you want to download
Wscript.Sleep 1000 'Pause

objShell2.Run "RAR APPLICATION" '(Winrar, Winzip, whichever)

WScript.Quit

After the line "objShell2.Run" you can continue with the objShell2.SendKeys method to execute commands within WinRar or whichever RAR application you are using.  Here is a link that should help you out a bit:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthsendkeys.asp

Hope this helps!
ASKER CERTIFIED SOLUTION
Avatar of fattumsdad
fattumsdad

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial