Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Running VBS using Window Scheduler

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,61736
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Running VBS using Window Scheduler
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Running VBS using Window Scheduler - 6/23/2008 2:49:39 AM   
  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


 
 
Post #: 1
 
 RE: Running VBS using Window Scheduler - 6/23/2008 10:35:39 PM   
  ninjamaster

 

Posts: 107
Score: 0
Joined: 1/23/2007
Status: offline
Have you tried compling the VBS into an EXE and running it that way?

(in reply to Spanky)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Running VBS using Window Scheduler Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts