Код:
@echo off
setlocal enableextensions enabledelayedexpansion
set sSourceFile=%~f0
for /f "usebackq skip=1 delims=" %%i in (
`wmic.exe DataFile where "Name='%sSourceFile:\=\\%'" get LastModified`
) do for /f "tokens=1" %%j in ("%%~i") do (
set sDateTime=%%j
set sYear=!sDateTime:~0,4!
set sMonth=!sDateTime:~4,2!
set sDay=!sDateTime:~6,2!
set sHour=!sDateTime:~8,2!
set sMinute=!sDateTime:~10,2!
set sSecond=!sDateTime:~12,2!
)
echo Source file: [%sSourceFile%]
echo --- LastModified ---
echo Year: %sYear%
echo Month: %sMonth%
echo Day: %sDay%
echo Hour: %sHour%
echo Minute: %sMinute%
echo Second: %sSecond%
endlocal
exit /b 0