Link to home
Start Free TrialLog in
Avatar of jcredle
jcredle

asked on

wscript.sleep not working

Can someone tell me whats up with this code, please?  Everytime I try to debug this it says that line 4 has a error and the error description is "Object required (WScript) - Sleep

Dim sh
Set sh = WScript.CreateObject("WScript.shell")
sh.Run "runas /user:local administrator ""manage1.msc"""
WScript.Sleep(5000)
sh.SendKeys "password~"
WScript.Quit
Avatar of KeithWatson
KeithWatson

This works for me, at least, without the third line, but the sleep call works on XP. I don't suppose it could be as simple as getting rid of the brackets? So, WScript.Sleep 5000. Also, I take it you are running this as a .vbs file?
Avatar of jcredle

ASKER

Yes, I am using this as a .vbs file.  I tried to run the script without the brackets also.
ASKER CERTIFIED SOLUTION
Avatar of KeithWatson
KeithWatson

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