when I run the following command in cmd manually, it works
for /F "delims=" %f in ('dir /B C:\Users\DMS\Downloads\*^|FileByAge.exe 2') do echo %f
However, when I put that command in a batch file and run it, I get the following:
\Users\DMS\Downloads\*|FileByAge.exe was unexpected at this time.
for /F "delims=" \Users\DMS\Downloads\*^|FileByAge.exe 2') do echo f
Any suggestion?
I am tying to make the answer from (Find out if file is older than 4 hours in Batch file) work in my case