I'm trying to write a batch file that iterates through each filename, takes part of the strings, and sets the created and modified dates.
Mind you, dirpath is a placeholder for actual path.
@echo off setlocal enabledelayedexpansion FOR /R dirpath %F in (*.*) DO (SET FNAME=%~nF SET MM=%FNAME:~0,2% SET DD=%FNAME:~2,2% SET YY=%FNAME:~4,2% nircmd.exe setfiletime %F "%DD% %MM%-20%YY% 00:00:00" "%DD%-%MM%-20%YY% 00:00:00")
I'm not sure how to even troubleshoot what the script is doing – pause doesn't pause the program after the loop.
How can this be rewritten to function?