@echo off setlocal enabledelayedexpansion

echo wscript.sleep 1000 > %temp%\time.vbs echo wscript.echo now >> %temp%\time.vbs for /f 'delims=' %%a in ('cscript //nologo %temp%\time.vbs') do set 'current_time=%%a'

rem Extract year, month, day, hour and minute from the current_time set 'year=!current_time:~0,4!' set 'month=!current_time:~4,2!' set 'day=!current_time:~6,2!' set 'hour=!current_time:~8,2!' set 'minute=!current_time:~10,2!'

rem Update the date and time date %year%%month%%day% time %hour%:%minute%

del %temp%\time.vbs endlocal

Batch Script for Getting and Updating System Date and Time

原文地址: https://www.cveoy.top/t/topic/DqG 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录