Untitled

 avatar
unknown
plain_text
2 years ago
924 B
2
Indexable
@echo off
echo Sistem zamanı ayarlanıyor...
echo.

REM Get the current date and time from a web server
for /f "tokens=2 delims==>" %%a in ('nslookup -debug pool.ntp.org 2^>NUL ^| find /i "Address"') do set "ntp_ip=%%a"
for /f "tokens=1-10" %%a in ('powershell -command "Invoke-WebRequest -Uri 'http://%ntp_ip%/';"') do (
    if "%%a"=="<BODY>" (
        set "day=%%d"
        set "month=%%e"
        set "year=%%f"
        set "hour=%%g"
        set "minute=%%h"
        set "second=%%i"
    )
)

REM Convert the hour to 24-hour format if necessary and add 3 hours for Turkish time
set /a "hour=hour+3"
if %hour% GEQ 24 set /a "hour=hour-24"
set "hour=0%hour%"
set "hour=%hour:~-2%"

REM Set the system time and date in Turkish format
echo Sistem zamanı %hour%:%minute%:%second% olarak ayarlanıyor...
time %hour%:%minute%:%second%
echo Sistem tarihi %day%/%month%/%year% olarak ayarlanıyor...
date %day%.%month%.%year%