How to retrieve the updated date in batch

2

I made a batch file, which changes the date of windows, however I want to create another file that when I run it, it retrieves the updated date. How to proceed?

    
asked by anonymous 10.07.2016 / 15:50

1 answer

1

Save the date is possible, but it's best to sync the date / time via the internet :

@echo off & color 0a && setlocal enableextensions enabledelayedexpansion

tzutil /s "E. South America Standard Time"

w32tm /query /status 2>nul >nul 

if not !errorlevel! == 0  (

     w32tm /register && net start w32time

     w32tm /config /manualpeerlist:a.ntp.br /syncfromflags:manual /reliable:yes /update

     w32tm /resync /force /nowait &&  net stop w32time 

     w32tm /unregister 

    ) else (

     w32tm /config /manualpeerlist:a.ntp.br /syncfromflags:manual /reliable:yes /update

     w32tm /resync /force /nowait &&  net stop w32time 

    )
    
21.11.2018 / 22:06