I have a folder which have some log files. I want to open the latest log file through command prompt i.e. the file having the latest modified date/time. I am able to go to the folder through command prompt but how can I access the last modified one?
The DIR command can sort by last modified date. FOR /F can process the result. The variable will be set to the last file listed.
Double up the percents if used within a batch script: