Is there a batch script that you can compile and have it run a command when a date/time is met.
13
answers
|
Answer it!
|
The following biterscripting ( http://www.biterscripting.com ) batch script will do it. It will wait until it is June 11, 1009, 2:30 pm, then execute command "command".
while ( gettime() < "20090611143000")
sleep(60)
system "command"
Jenni
Type in 'echo %date%' (without the quotes) and press Enter.
The date is displayed.
Now type in '%time%'
The time is displayed, but to a resolution of 1/1000th of a second!
You can use comparison operators in batch files, but there's no way (that I know of) of masking out part of the %time% string so you could compare, but you'd probably miss the event!
A better way of doing what you want is to use the built-in scheduler. To get to this, go to Control Panel then Scheduled Tasks. You can run any program you like (including batch files) from there.
You can also set up the scheduler from a batch file, which is closer to what you're after. It can run once, or every hour, week etc. You need to use the AT command, so your set-up batch would be something like :
AT 14:30 NEXT:25 C:\MYBATCH
This would run your batch file (mybatch) at 2:20 PM on the 25th of the month.
try echo %time:~0,8% or echo %time:~0,5%.
Also try ...
set variable=123abc
echo %variable:abc=456%
Many thanks - I'll be using that in the future.
![]() |

































