[英]windows batch dir command get last modified directory starting with string
我想獲取Windows批處理文件中以字符串stringEx...
開頭的最后修改目錄。
例如:我有一個包含以下子目錄的文件夾:
- Directory -Subdirectory1 -Subdirectory2 -Anothersubdirectory ....
我嘗試了一下,但是沒有用:
@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%
有任何想法嗎?
for /f "delims=" %%a in ('dir /b /ad-h /od "Anoth*"') do set "latestDir=%%~a"
echo(%latestDir%
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.