I want to get the last modified directory starting with a string stringEx... in a windows batch file.
For example: I have a folder containing sub-directories like this :
- Directory -Subdirectory1 -Subdirectory2 -Anothersubdirectory ....
I tried with this but it doesn't work:
@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%
Any ideas?
for /f "delims=" %%a in ('dir /b /ad-h /od "Anoth*"') do set "latestDir=%%~a"
echo(%latestDir%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With