16/10/08 07:09:00.83 sXvXMvPu.net
@echo off
set "a=/aaa/bbb/ccc\ddd"
set "b="
call :x a b
echo "%a%"
echo "%b%"
pause
goto :eof
:x
setlocal enabledelayedexpansion
set "a=/!%1!"
set b=-1
:y
set "c=!a:~%b%,1!"
if "!c!" == "/" goto z
set /a b-=1
goto y
:z
set "c=!a:~%b%!"
endlocal & set "%2=%c%"
goto :eof