Page 1 of 1
Set Clock back for hours
Posted: 10 Feb 2014 04:04
by carmine
Hi,
I have this codes which does the clock back in minutes i need to set back for 2 hours. How to do that.
Code: Select all
@echo off
set /a mm=%time:~3,2%
set /a hh=%time:~0,2%
if %mm% lss 5 (set /a hh=%hh%-1) & set /a mm=%mm%+60
if %hh% equ -1 set /a hh=23
set /a mm=(%mm%-5)
time %hh%:%mm%
(set mm=) & set hh=
Re: Set Clock back for hours
Posted: 10 Feb 2014 04:21
by foxidrive
What do you want to happen if it is 1am? Will it have to change to 11pm the day before?
Re: Set Clock back for hours
Posted: 10 Feb 2014 04:46
by carmine
foxidrive wrote:What do you want to happen if it is 1am? Will it have to change to 11pm the day before?
Thanks for response.
Infact the script will be run under schedule task at 11:45 P.M. To delay the date (day) change.
Re: Set Clock back for hours
Posted: 10 Feb 2014 04:49
by foxidrive
carmine wrote:Infact the script will be run under schedule task at 11:45 P.M. To delay the date (day) change.
Then all you need to do is this for that one time:
Try it at the command line.
Re: Set Clock back for hours
Posted: 10 Feb 2014 05:05
by carmine
Hi,
Tricky, Thanks foxidrive.
Is there any trick to sync the time with server any tricky way.
Thanks
Re: Set Clock back for hours
Posted: 10 Feb 2014 05:16
by foxidrive
In Windows 8 there is this in the help for
and it should be in earlier version too.
w32tm /resync [/computer:<computer>] [/nowait] [/rediscover] [/soft]
Tell a computer that it should resynchronize its clock as soon
as possible, throwing out all accumulated error statistics.
computer:<computer> - computer that should resync. If not
specified, the local computer will resync.
nowait - do not wait for the resync to occur;
return immediately. Otherwise, wait for the resync to
complete before returning.
rediscover - redetect the network configuration and rediscover
network sources, then resynchronize.
soft - resync utilizing existing error statistics. Not useful,
provided for compatibility.
Re: Set Clock back for hours
Posted: 10 Feb 2014 05:39
by carmine
Hi,
Thanks a lot.