@FILENAME[filename] : Returns the name and extension of a file, without a path.


The filename must be in quotes if it contains white space or special characters. On an LFN drive, the returned filename may contain white space or other special characters. To avoid problems which could be caused by these characters, quote the returned name before you pass it to other commands.




echo %@filename["D:\my path\myfile.exe"]



echo %@filename["%comspec"]