小编dan*_*110的帖子

How to find the last directory created in batch

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)
Run Code Online (Sandbox Code Playgroud)

but this result keeps returning the oldest directory not the most recent one.

Still trying to pick this up in batch.

windows directory datetime cmd batch-file

5
推荐指数
1
解决办法
1376
查看次数

标签 统计

batch-file ×1

cmd ×1

datetime ×1

directory ×1

windows ×1