0

so i got a folder containing multiple txt file for example: this is the path C:\folder

txt1.txt
txt2.txt
txt3.txt

each one is created at the same day but different time. i need to output the date and time of latest date modified file in that folder using batch file

1 Answer 1

0

You can capture the output of the DIR command with a FOR /F command.

Pushd "c:\folder"
FOR /F "delims=" %%G IN ('dir /TW /OD *.txt') do SET "filedate=%%~tG"
popd

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .