I\'m working on a batch script that will let me delete files older then a set period using forfiles. For now, I\'m aiming at printing the files that will be deleted.
This an old question but I've got a different answer... in case anyone needs it.
When using 'forfiles', the path (written after /p) CAN be between quotation marks. However, it must not end with a slash.
If you want to run 'forfiles' for the root directory of a drive:
forfiles /p "C:" /c "cmd /c echo @file"
If you want to process files in a different directory...
forfiles /p "C:\Program Files" /c "cmd /c echo @file"
In other words, the safest approach is:
forfiles /p "C:\Path\Without\Trailing\Slash"