Aqui está um método que deve funcionar:
echo %string% | findstr " / \ " >nul && for %%A in (%string%) do set string=%%~nA
before: apiserver_sdk
after: apiserver_sdk
before: D:/dev/some/folder/GO/projectName
after: projectName
before: c:\one\two three\four five
after: five
before: "c:\one\two three\four five"
after: four five