Please find below the batch script :-
@echo off
setlocal enableextensions enabledelayedexpansion
set /a count = 0
for /D %%i in (*) do (
set /a count += 1
echo !count! %%i
cd \d %%i
echo "inside" %cd% " to execute some command"
echo "some command"
echo "now again going one directory back"
cd ..
)
endlocal
execution of
cd \d %%i
gives below error :-
The system cannot find the path specified.
i want to go inside the directory that %%i represents, perform some command there, then want to go one directory back.
Use cd /d
not cd \d
cd
will assume the directory you want to change to is \d %%i