BAT: Get file with latest date..

1 post / 0 new
benzzon
benzzon's picture
BAT: Get file with latest date..

----- batch begins ------- 

@echo off
set ynf=
for /f "delims=" %%i in ( ' dir /b /o:d /a:-d "C:\documents and settings" ' ) do set ynf=%%i
if defined ynf echo newest file is "%ynf%"
if not defined ynf echo "no files were found"
 
------ batch ends --------