Here is the solution..
You can just go to the folder by writing the path
cd / d Result
cd /d Result
for /f "usebackq delims=*" %%f in (`dir /b /o:-d /tc %a%`) do (ren "%%f" file-!count:~1!.jpg
set /a count+=1
SetLocal EnableDelayedExpansion Expansion of variables through signs (!)
cd / d Result go to the Result folder
set "count = 1000" variable in which I marked the number of zeros file-001.jpg
set a = "*. jpg" the variable indicates which files we are looking for.
dir /b /o:-d /tc %a%)
dir - Displays a list of files and subdirectories. Next, we sort.
/b - Display only filenames.
/o:-d - Sorts the list of displayed files in reverse order (newest to oldest).
/tc - Sort by file creation time.
%a% - Call the variable.
usebackq Sets the ability to use quotes for filenames Like this> ".
Specifies the execution of a string, enclosed in back quotes, as commands Like this> `,
and strings in single quotes are like commands in a character string Like this> '.
delims = xxx Specifies a set of delimiters. Overrides the default space-tab delimiter set.