echo name of file bat code example
Example: batch filename
@echo off
setlocal
set file=C:\Users\l72rugschiri\Desktop\fs.cfg
for %%i IN ("%file%") DO (
echo filedrive=%%~di
echo filepath=%%~pi
echo filename=%%~ni
echo fileextension=%%~xi
)
REM # | filedrive | %~d[file-variable-name]
REM # | filepath | %~p[file-variable-name]
REM # | filename | %~n[file-variable-name]
REM # | file-extension | %~x[file-variable-name]