Use the right tool for the job. This is a job for a Regular Expression!
FOR /F "tokens=*" %%F IN ('POWERSHELL -command "'%~1' -Replace '([A-Z]:)?(.*\\)*', ''"') DO ECHO The path is %~dp1 and the filename is %%F
The Regular Expression used in this command matches an optional drive letter and colon, followed by zero or more strings ending with "". Everything following the last "" is the part we want to keep. The PowerShell "-Replace" parameter replaces the matched string (the drive and path) with the empty string, leaving only the filename.extension. If filename.extension contains wildcards, they are left intact.