How to get windows batch’s parent folder

The parent folder of a Batch is in the Variable %~dp0 located. Example:

@echo off&setlocal
for %%i in ("%~dp0.") do set "folder=%%~fi"
echo %folder%

Leave a Comment