- @echo off
-
- set currPath=%~dp0
-
- set parentPath=
-
- set parentPaths=
-
- :begin
-
- FOR /F "tokens=1,* delims=\" %%i IN ("%currPath%") DO (set front=%%i)
- FOR /F "tokens=1,* delims=\" %%i IN ("%currPath%") DO (set currPath=%%j)
-
-
-
- if not "%parentPath%" == "" goto gotJpdaOpts
-
-
- :gotJpdaOpts
-
-
- if "%parentPath%%front%\"=="%~dp0" goto end
- set parentPath=%parentPath%%front%\
- if "%parentPath:~-1%" == "\" set parentPaths=%parentPath:~0,-1%
-
-
-
- goto begin
-
-
- :end
-
- echo %parentPath%%front%
-
- echo %parentPath%
-
- echo %parentPaths%
-
- pause