VBS file to wait certain amount of time then launch program (500pts)

I would like to know how to write a vbs file such that it can be run as a logon script. Once ran it will wait a given amount of time say 30 seconds while windows is loading and then launch the program with certain /switch1 /switch2 /switch3 parameters. Also if the script could be run either minimized or hidden that would be great.

The reason I need to do it this way is because the program I am running puts an icon down in the taskbar. If the script runs too early before windows is fully loaded there is no taskbar and therefore it doesnt work.

Thanks
LVL 35
Joseph DalyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

and235100Commented:
WScript.Sleep(1000)

(number in miliseconds)
0
and235100Commented:
i.e.

WScript.Sleep 30000
0
and235100Commented:
vbscripts will run by default hidden - i.e. during logon.

i.e. - with group policy:

gpedit.msc
User Config. \ Admin. Templates \ System \ Scripts
"Run Logon scripts visible"
You can set this to "Disabled"
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Joseph DalyAuthor Commented:
Ok now what about the second part of the question. How do I launch the program using the switches with a VBS script?
0
and235100Commented:
What is the program?
Is it just an exe - or a com, bat - which?
0
and235100Commented:
Local exe:

Set objApp = CreateObject("WScript.Shell")
objApp.Run "cmd /C CD C:\ & Program Files & SomeFolder & SETUP"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
and235100Commented:
Or:

Set objApp = CreateObject("WScript.Shell")
objApp.Run "cmd /C net use z: \\comp\path\ [password] & z: & setup"

for an setup.exe on a remote drive.
0
RobSampsonCommented:
Or
strExe = "C:\Program Files\Microsoft Office\Excel.exe"
strParam1 = "C:\Temp\Test.xls"
strParam2 = "C:\Temp\Test2.xls"
Set objShell = CreateObject("WScript.Shell")
objShell.Run """" & strExe & """ """ & strParam1 & """ """ & strParam2 & """", 1, True


Regards,

Rob.
0
and235100Commented:
Hope that was helpful.
Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.