Computing.Net > Forums > Programming > How to run script at certain time?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How to run script at certain time?

Reply to Message Icon

Name: mikesoong
Date: October 10, 2006 at 09:54:46 Pacific
OS: NT/XP
CPU/Ram: P4
Product: HP
Comment:

I want a bat script that will check the local PC time, if the time is between 5.00pm to 8.59am, then the bat script will call another script else it will not do anything.

Anyone can help me please?



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: October 10, 2006 at 15:01:49 Pacific
Reply:

::== 5to9.bat
@echo off
setLocal EnableDelayedExpansion

set run=n
for /f "tokens=1 delims=:" %%T in ('echo %TIME%') do (
set T=%%T
if !T! gtr 16 set run=y
if !T! lss 9 set run=y
)
if !run! equ y echo myother.bat
::== DONE

To enable, edit last line; remove "echo" and put in the name of your bat.



=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 2
Name: mikescm78
Date: October 10, 2006 at 19:05:47 Pacific
Reply:

Thank you very much you are my saviour.


0

Response Number 3
Name: mikescm78
Date: October 11, 2006 at 01:55:42 Pacific
Reply:

If I use GOTO instead of calling another script should I write like this:

if !run! equ y GOTO myother.bat

:myother.bat
....
....


0

Response Number 4
Name: Mechanix2Go
Date: October 11, 2006 at 02:02:25 Pacific
Reply:

Yes, but you want an 'exit' in between.

if !run! equ y GOTO myother.bat
goto :eof
:myother.bat


=====================================
If at first you don't succeed, you're about average.

M2



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Run bat script on certain... Batch File Beep / task ki...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: How to run script at certain time?

Run program at certain time www.computing.net/answers/programming/run-program-at-certain-time/5947.html

How to run *.aspx on a website (ASP www.computing.net/answers/programming/how-to-run-aspx-on-a-website-asp/7690.html

How to run a batch file on another www.computing.net/answers/programming/how-to-run-a-batch-file-on-another-/15653.html