Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Right now at work I have to small servers getting their time from a larger server via batch files and scheduled task.
The batch reads:
net time \\shoptech /set /yesI need the time on the two computers to be six minutes behind the time that they get from the larger server. Is there a command to set the system clock back a certain amount of minutes?
My name is JRComp, and I approve this message.

So maybe add some math stuff to your batch, The following will do the sync and then subtract 6 min.
net time \\shoptech /set /yes
set /a mm=%time:~3,2%
set /a hh=%time:~0,2%
if %mm% lss 6 set /a hh=%hh%-1
if %mm% lss 6 set /a mm=%mm%+60
set /a mm=%mm%-6
if %mm% lss 10 set mm=0%mm%
if %hh% equ -1 set hh=23
time %hh%:%mm%
set mm=
set hh=

it seems like date/time addition/subtraction is VERY common theme. hint microsoft: your programmers have already done the work (vb DateDiff, DateAdd. vbscript, etc etc), wh(ine)ot put same code into batch script?
(sorry).

And how popular has PowerShell been? Perhaps there's one PowerShell user for every 10 batch file users? And that's after PS has been out for about 3 years

klint: And how popular has PowerShell been?
Presumably it'll get more popular as XP systems are retired. Personally, I wish MS wouldn't "forget" to include some ActiveX scripting objects while pushing PS. (ScriptPW.Password, specifically.)Actually, just be glad MS didn't go with their original plan, which was to remove CMD altogether and have PS be the only command line interface.

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |