Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
948 B
1
Indexable
Never
@echo off
echo Sistem zamanı ayarlanıyor...
echo.

REM Get the current date and time from a web server
for /f "delims=" %%a in ('powershell -command "Invoke-WebRequest -Uri time.windows.com -UseBasicParsing | Select-Object -ExpandProperty Headers | Where-Object Name -eq 'Date'"') do set "webtime=%%a"

REM Convert the web server time to the correct format
set "day=%webtime:~8,2%"
set "month=%webtime:~5,2%"
set "year=%webtime:~0,4%"
set "hour=%webtime:~11,2%"
set "minute=%webtime:~14,2%"
set "second=%webtime:~17,2%"

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%