0

In my batch file I cycle through different folders

using this

for /F "delims=" %%c in ('dir /ad /b') do (

however, when I use echo %cd% I get the path where the file started from and not the path where the file is currently operating, what would I need to echo to do this?

This is the part that I'm talking about:

@echo off
:GET_THIS_DIR
pushd %~dp0
set THIS_DIR=%CD%
popd
goto :EOF
cd %1
    for /F "delims=" %%a in ('dir /ad /b') do (
        rem sequence
        cd %%a
        for /F "delims=" %%b in ('dir /ad /b') do (

                cd %%b
                for /F "delims=" %%c in ('dir /ad /b') do (
                    cd %%c
                    for /F "delims=" %%d in ('dir /ad /b') do (
                        cd %%d
                            for /F "delims=" %%e in ('dir /ad /b') do (
                            cd %%e

                            echo %%e
                            echo %cd%
                            Pushd "%~dp0"

                            call :GET_THIS_DIR
                            echo I am here: %THIS_DIR%
                            goto :EOF


                            cd ..
                            )
                         cd ..
                    )
                    cd ..
                )
                cd ..
        )
        cd ..
    )
pause

Frezzley
  • 173
  • 1
  • 12

0 Answers0