@echo off call :set_arg arg if not defined arg goto :eof for %%f in (%arg%) do echo "%%~nxf" pause & goto :eof
:set_arg setlocal enabledelayedexpansion set a=!cmdcmdline! set /a b=0,n=0 set "s=" & set "c=/" & set "e= " & set "d="" :x1 if not !a:~%b%^,1!==!c! set /a b+=1 & goto x1 :x2 if !a:~%b%^,1!==!d! set /a n+=1 if !n! equ 3 set /a b+=2 & goto x3 set /a b+=1 & goto x2