如何找到批量创建的最后一个目录 [英] How to find the last directory created in batch

查看:239
本文介绍了如何找到批量创建的最后一个目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的第一个问题,我不是很使用批处理文件,所以希望有人能帮助有经验的。

我想找到使用批处理文件创建的最后一个目录,并曾尝试:

  FOR / F令牌= *%%的A('目录%latestdirectory%/ AD-H / B / O D')做(最近设置=% %一个)

但这个结果返回保持最古老的目录不是最新的。

仍在试图批量接这个了。


解决方案

  FOR / Fdelims =%%的('DIR%latestdirectory%/ AD-H A / B / OD)就(设近= %% A)

寻求帮助输入 DIR /?在命令行。

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.

解决方案

FOR /f "delims=" %%A in ('dir "%latestdirectory%" /AD-h /B /od') do (set recent=%%A)

for help enter dir /? at the command line.

这篇关于如何找到批量创建的最后一个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆