Answer the question
In order to leave comments, you need to log in
How to correctly form a request in a bat script?
Good day!
You need to get the name of the first file and pass it to a variable when sorting by the third character of the file name.
There is a working version of the command that gives the correct output: DIR /b /o "%folder%\%FiLE_MASK%" | SORT /+3 /R
The FOR loop only works like this:
for /f %%i in ('DIR /b /o "%folder%\%FiLE_MASK%"') do set filename=%%i
for /f %%i in ('DIR /b /o "%folder%\%FiLE_MASK%" | SORT /+3 /R') do set filename=%%i
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question