Quantcast
Channel: DaniWeb Microsoft Windows Topics
Viewing all articles
Browse latest Browse all 2775

Task Scheduler

$
0
0

Hi all,

I am trying to schedule a Task that will run a vb script to open a browser, send some keys, and finally close the browser. The task starts, but seems to hang. The task is created as follows:

schtasks.exe /Create /RU "SYSTEM" /SC "DAILY" /MO "1" /ST "23:00" /TN "Open Browser" /TR "C:\somefolder\somescript.vbs"

The script looks like:

Set oShell = WScript.CreateObject("WScript.Shell")

oShell.Exec "iexplore http://localhost/mylocalsite"

WScript.Sleep 10000

oShell.SendKeys "uname"
oShell.SendKeys "{TAB}upassword"
oShell.SendKeys "{ENTER}"

WScript.Sleep 20000

'Close browser'
oShell.SendKeys "^w"

Also, adding c:\program files\internet explorer\ to my path variable allows me to execute iexplore as a command.


Viewing all articles
Browse latest Browse all 2775

Trending Articles