I recently came across to a situation where need to fetch parent directory of currently being executed batch file. Searched for the solution on google and stackoverflow but could find a clean and easy solution.
Asked
Active
Viewed 826 times
1 Answers
3
Not sure if this is what you were looking for.
@echo off
for %%a in ("%~dp0\.") do echo "%%~dpnxa"
for %%a in ("%~dp0\.") do for %%b in ("%%~dpa\.") do echo "%%~dpnxb"
pause

Squashman
- 13,649
- 5
- 27
- 36