【发布时间】:2013-12-06 14:55:59
【问题描述】:
我想在 Windows 批处理文件中获取以字符串 stringEx... 开头的最后修改目录。
例如:我有一个包含这样子目录的文件夹:
- 目录 -子目录1 -子目录2 -另一个子目录 ……我试过了,但它不起作用:
@echo off
Setlocal EnableDelayedExpansion
Set foundedFolder
FOR /F %%i IN ('dir C:\Directory | subtsr "Anoth*" /b /ad-h /od') DO (SET a=%%i)
%foundedFolder%=%a%
有什么想法吗?
【问题讨论】:
-
是
subtsr外部命令吗? -
只要
dir C:\Directory\Anoth* /b /ad-h /od。 -
dir /b /ad-h /od | find /i "\Anoth"?? -
每个文件夹都有一个最后修改日期,但它可能有用也可能没用,这取决于您的需要。仅当直接在其中创建、删除或重命名文件或文件夹时,才会更新父文件夹的修改日期。如果文件的内容发生更改,或者在子文件夹中创建、删除或重命名文件或文件夹,则它不会更改。我从来没有发现这很有用。
标签: windows batch-file cmd substr dir