@echo off
for %%c in (p0 n0 l n m) do set %%c=
set p0=1:2\dasfds\ fdsaf\dsa f\sda \fdsa f\as df\abc.gho
strings n0=length %p0%
:fn
strings l=mid %p0%,%n%,1
if %l%*==\* set m=%n%
if %n%*==%n0%* goto fn_
strings n=add %n%,1
goto fn
:fn_
strings p=left %p0%,%m%
for %%c in (p0 n0 l n m) do set %%c=
echo %p%