If you do not want to deal with quotes, you can use the switch "s" in% ~ dpnx [] ... this will result in short file names that are easy to work with.
from the command line ...
for /f "delims=" %f IN ('dir /b /s "C:\Program Files\*.dll"') do echo %~sdpnxf
inside the .CMD / .BAT file you need to "run away" from [%], for example, double [%%]
for /f "delims=" %%f IN ('dir /b /s "C:\Program Files\*.dll"') do echo %%~sdpnxf
thomspengler Apr 6 2018-11-11T00: 00Z
source share