@echo off
:: Check if the script is running as Administrator
NET SESSION >nul 2>&1
if %errorLevel% NEQ 0 (
echo Requesting administrative privileges...
powershell -Command "Start-Process '%~f0' -Verb runAs"
exit /b
)
:: Detect the current date format (MM-dd-yyyy or dd-MM-yyyy) using PowerShell
for /f %%A in ('powershell -Command "(Get-
Culture).[Link]"') do set "dateFormat=%%A"
:: Set the date based on detected format
if "%dateFormat%"=="M/d/yyyy" (
:: Format is MM-dd-yyyy, set date to 07-15-2023 (July 15, 2023)
date 07-15-2023
) else (
:: Format is dd-MM-yyyy, set date to 15-07-2023 (15 July 2023)
date 15-07-2023
)
:: Get the current folder where the script is running
set "scriptDir=%~dp0"
:: Start the [Link] program located in the 'AndroidUtility' folder
inside the same folder as the script
start "" "%scriptDir%\AndroidUtility\[Link]"
:: Add a delay to allow the program to run for a while before resetting the date
timeout /t 0
:: Restart the Windows Time service to ensure it's running
net stop w32time
net start w32time
:: Sync the date to the current time using the Windows time service
w32tm /resync
:: Exit the script
exit