Software >> OS >> Windows >> Command Line >> How to rename files with the date stamp prefix prepended

e.g. In this example the output of dir is first piped through findstr command to include only lines that contain the keyword 2012. Adjust this accordingly to filter lines that you want to run through the for loop. for /f "tokens=1,2,3,7 delims=/ " %a in ('dir ^| findstr 2012') do rename %d %c-%b-%a-%d