开发者

Windows batch file: choosing a file from a directory based on directory name

开发者 https://www.devze.com 2022-12-28 17:52 出处:网络
I don\'t do windows batch programming, nor do I need to go that far down the rabbit hole. I have d开发者_Python百科irectory structures as such:

I don't do windows batch programming, nor do I need to go that far down the rabbit hole.

I have d开发者_Python百科irectory structures as such:

dir1000000/file.txt
dir2000000_1/file.txt
dir2000000_2/file.txt

I need to select the file.txt from the path with the lexicographically greatest value, i.e. dir2000000_2/file.txt. How do I go about doing this?


Assuming the file is always file.txt and only the directory is variable...

FOR /F "delims=" %%a IN ('DIR /ad/b/on') DO SET mydir=%%a
SET myfile=%mydir%\file.txt
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号