FOR /F %%a in ('echo %~n0') do set name=%%a FOR /F %%a in ('echo %~x0') do set ext=%%a echo Dateiname: %name% echo Dateiextension: %ext%