How do I copy the newest file in a directory somewhere else from the command line in windows vista
问题 I have a directory of many files in Windows Vista. I'd like in a batch script to be able to pick the newest file and copy it to another location. Any ideas how I do that? 回答1: You can use the for command to invoke a directory listing that is sorted by date, and use it to set an environment variable, if you set the same variable to each file, then it will end up being set to the latest file. put this into a batch file: for /F "delims=" %%I in ('dir /b /a-d /od') do set LATEST=%%I echo "%LATEST