DOS Commands examples

REM display file name and last modified time
for %i in ("c:\*.*") do @echo %i, %~ti

REM multiple commands display the oldest file
@echo off & (for /f %i in ('dir /a-d /o-d /tc /b "c:\*.*"') do set my_old_filename=%i) & dir /tc "c:\%my_old_filename%" | find "%my_old_filename%" 

REM the current path
@echo %~dp0
Advertisements