@echo off setlocal set file=C:Usersl72rugschiriDesktopfs.cfg for %%i IN ("%file%") DO ( echo filedrive=%%~di echo filepath=%%~pi echo filename=%%~ni echo fileextension=%%~xi )