SyntaxFix
Write A Post
Hire A Developer
Questions
If you want to remain both filename (only) and extension, you may use %~nxF:
%~nxF
FOR /R C:\Directory %F in (*.*) do echo %~nxF