is there a way with windows command line to list all the files from a specific directory and then select the name of the file that has the newest creation date.
Thank you
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This iterates through a directory listing and sets an environment variable to each file in order by date; the last one set would be the newest file:
Then you could copy the file like so:
Based on the solution found here.
EDIT: I also got the
%%I was unexpected at this timeerror when executing this directly through the command prompt, but it worked fine from within a batch file. You could create a batch file with the above and it should work.