1.

Solve : set time in batch + 10sec more!?

Answer»

hi
i want to set my time in "AT" command with +10sec more, something like that;

example:
system time=01:24
my time in batch set to=01:34

example:

at [system time + 10 sec] /interactive notepad.exe

i hope you understanding my question

SORRY FOR MY BAD ENGLISH Changing your system time is easy, but adding 10 seconds? Trying to figure out why you need to add 10 seconds from current system time. Do you want files to have date/time stamp 10 seconds in the future to what the current system time really is? Are you looking for a 10 second delay in which sleep or a bunch of pings to 127.0.0.1 can be used?i don't want 10 second delay!
i want set current time + adding 10 second more to my batch file, like:

default command:
AT [\\computername] time [/INTERACTIVE] "command"

i want:

at [system_time+10sec_more] /interactive cmd.exeQuote from: behzad-007 on AUGUST 08, 2011, 04:32:48 AM

i want set current time + adding 10 second more to my batch file, like:

Like Dave asked, why are you doing it that way, and not using a simple 10 second delay?
Quote from: Salmon Trout on August 09, 2011, 11:56:56 PM
Like Dave asked, why are you doing it that way, and not using a simple 10 second delay?

because in "AT" command you must set time, you can't use delay! But you want it to happen in 10 seconds time. So why use AT?
Quote from: behzad-007 on August 08, 2011, 04:32:48 AM
i don't want 10 second delay!
i want set current time + adding 10 second more to my batch file, like:

default command:
AT [\\computername] time [/INTERACTIVE] "command"

i want:

at [system_time+10sec_more] /interactive cmd.exe

It doesn't make sense. Why do you need the scheduler and not use a time delay as suggested? Does the AT command even support seconds? The system scheduler (GUI) does not.

Batch code does not really do date/time computes very well. All data is seen as a string, so even though you can do integer arithmetic, you run into that pesky problem of the seconds possibly carrying over to the next minute which in turn can carry over into the next hour and so forth. Pretty soon it's next year and then where are you?

VBScript can handle the date/time arithmetic and there is a CLASS for the AT scheduler.



You could always count one Mississippi, two Mississippi etc. When you get to ten Mississippi launch the missiles command. If you use military cadence, you can improve the ten second precision.Quote from: behzad-007
hi
example:
system time=01:24
my time in batch set to=01:34

Judging by this, I am not convinced he knows the difference between seconds and minutes.
Hi Sidewinder,

I agree with you. Both AT and SCHTASKS don't support seconds at all.

Yes, it's difficult to calculate data/time in batch code, especially we need consider the next hour/month/year and leap-year. But we can use Epoch. You may want to have a look at the fuctions of Ritchie Lawrence.

http://www.commandline.co.uk/lib/treeview/index.php


Discussion

No Comment Found