tags:

views:

21

answers:

1

I am using dir /B /A:D /O-D /TC to get the list of Directories. I need the first result returned by this result.

I tried looping and setting the first one, but I dont know how to break out of the loop after taking the top result. Please help.

@echo off

FOR /F "tokens=*" %%G in ('dir /B /A:D /O-D /TC') DO (set latest=%%G)

echo %latest%
+1  A: 

Is this what you need?

http://stackoverflow.com/questions/1724278/help-writing-dos-script-to-get-get-name-of-the-most-recent-directory-time-create

SteveCav
oh god..I cant blv it...It was (). Thanks so much..I cant blv i was that stupid..
Yes this is the answer..:)