• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

Sign in to follow this  

Delay running of vbs/bat on Windows startup for 60 seconds

Recommended Posts

+Elliot B.    1,502

I have the following VBS script that runs on Windows startup:

Set WshShell = CreateObject("WScript.Shell") 
WshShell.Run chr(34) & "C:\processend.bat" & Chr(34), 0
Set WshShell = Nothing

processend.bat consists of a list of taskkill /t /im commands.

 

However, the VBS script is running when Windows starts up, before the background tasks are even running.

 

Is it possible to delay running the script for 60 seconds after startup?

 

Something like a timeout in the BAT, above the taskkill commands, perhaps?

Share this post


Link to post
Share on other sites
Daedroth    489
WScript.Sleep 60000

That would sleep the script for 60 seconds (time is specified in milliseconds).

  • Like 1

Share this post


Link to post
Share on other sites
+Elliot B.    1,502
4 minutes ago, Daedroth said:

WScript.Sleep 60000

That would sleep the script for 60 seconds (time is specified in milliseconds).

Which line do I pop that on in the VBS?

Share this post


Link to post
Share on other sites
Daedroth    489

In that three line script, I'd make it the first line.

  • Like 1

Share this post


Link to post
Share on other sites
+Elliot B.    1,502
1 minute ago, Daedroth said:

In that three line script, I'd make it the first line.

Fantastic, thank you!

Share this post


Link to post
Share on other sites
Daedroth    489
Just now, Elliot B. said:

Fantastic, thank you!

No problem. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.