1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| @echo off
setlocal enabledelayedexpansion
if exist tmp.txt del tmp.txt
call:datecreation %1
echo Le fichier !fichier! a ete cree le !datecreation!, a !heurecreation!.
set "state=plus"
if "!datecreation:~0,2!" EQU "!DATE:~0,2!" if "!heurecreation:~0,2!" EQU "!TIME:~0,2!" set "state=moins")
echo Le fichier !fichier! a ete cree il y a !state! de 24h.
pause>nul
:datecreation
set "fichier=%~nx1"
dir /tc !fichier! >> tmp.txt
for /f "tokens=1 delims= " %%a in ('type tmp.txt ^| find "!fichier!"') do (set "datecreation=%%a")
for /f "tokens=2 delims= " %%b in ('type tmp.txt ^| find "!fichier!"') do (set "heurecreation=%%b")
goto:eof |
Partager