| |
Spanky
Posts: 1
Score: 0
Joined: 6/23/2008
Status: offline
|
Hello, As I am very new to VB and as I am sure there are people out there much smarter than me and I was hoping someone could help me with a small problem. I have a batch file which in the middle of will run a VB script that is intended to telnet into a server, run a SQL script, leave the server and then FTP the output from the SQL to my local PC. The problem I am having is trying to run a VBS file using the Windows scheduler. Running on it's own the VB script runs fine however running through the scheuler it does nothing. If someone could please help me understand what I'm doing wrong I would really be thankful. BTW - My OS is XP Here is the call command I'm using in the batch file, call cscript C:\ar.vbs //B If someone could please help me understand what I'm doing wrong I would really be thankful. Here is the VB code, Dim WshShell Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.run"cmd.exe" WScript.Sleep 500 WshShell.SendKeys"telnet 127.0.0.0" WshShell.SendKeys("{Enter}") WScript.Sleep 2000 WshShell.SendKeys"ID123" WshShell.SendKeys("{Enter}") WScript.Sleep 2000 WshShell.SendKeys"password1" WshShell.SendKeys("{Enter}") WScript.Sleep 2000 WshShell.SendKeys"db2 -tvf myscript.sql > myscript.out" WshShell.SendKeys("{Enter}") WScript.Sleep 4000 WshShell.SendKeys"exit" WshShell.SendKeys("{Enter}") WScript.Sleep 2000 WshShell.SendKeys"ftp 127.0.0.0" WshShell.SendKeys("{Enter}") WScript.Sleep 2000 WshShell.SendKeys"ID123" WshShell.SendKeys("{Enter}") WScript.Sleep 2000 WshShell.SendKeys"password1" WshShell.SendKeys("{Enter}") WScript.Sleep 2000 WshShell.SendKeys"lcd C:\downloads" WshShell.SendKeys("{Enter}") WScript.Sleep 2000 WshShell.SendKeys"get myscript.out" WshShell.SendKeys("{Enter}") WshShell.SendKeys"quit" WshShell.SendKeys("{Enter}") WScript.Sleep 500
|
|