Joseph Daly
asked on
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
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
i.e.
WScript.Sleep 30000
WScript.Sleep 30000
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"
i.e. - with group policy:
gpedit.msc
User Config. \ Admin. Templates \ System \ Scripts
"Run Logon scripts visible"
You can set this to "Disabled"
ASKER
Ok now what about the second part of the question. How do I launch the program using the switches with a VBS script?
What is the program?
Is it just an exe - or a com, bat - which?
Is it just an exe - or a com, bat - which?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or:
Set objApp = CreateObject("WScript.Shel l")
objApp.Run "cmd /C net use z: \\comp\path\ [password] & z: & setup"
for an setup.exe on a remote drive.
Set objApp = CreateObject("WScript.Shel
objApp.Run "cmd /C net use z: \\comp\path\ [password] & z: & setup"
for an setup.exe on a remote drive.
Or
strExe = "C:\Program Files\Microsoft Office\Excel.exe"
strParam1 = "C:\Temp\Test.xls"
strParam2 = "C:\Temp\Test2.xls"
Set objShell = CreateObject("WScript.Shel l")
objShell.Run """" & strExe & """ """ & strParam1 & """ """ & strParam2 & """", 1, True
Regards,
Rob.
strExe = "C:\Program Files\Microsoft Office\Excel.exe"
strParam1 = "C:\Temp\Test.xls"
strParam2 = "C:\Temp\Test2.xls"
Set objShell = CreateObject("WScript.Shel
objShell.Run """" & strExe & """ """ & strParam1 & """ """ & strParam2 & """", 1, True
Regards,
Rob.
Hope that was helpful.
Thank you
Thank you
(number in miliseconds)