This question already has an answer here:
- Get last created directory batch command 2 answers
This is my first question and I'm not very experienced using batch files so hope someone can help.
I want to find the last directory created using a batch file and have tried:
FOR /f "tokens=*" %%A in ('dir "%latestdirectory%" /AD-h /B /o-d') do (set recent=%%A)
but this result keeps returning the oldest directory not the most recent one.
Still trying to pick this up in batch.