CODE: [Copy to clipboard]@echo off for /f "delims=" %%a in (file.txt) do set pathname=%%~dpa echo %%pathname%% equal to %pathname% pause