Я получил решение, но все еще в замешательстве, как будто я удаляю echo %%G
, echo %%H
, echo back to
.. код по-прежнему не может сказать, ( unexpected at this time
.
@echo off
::SETLOCAL EnableDelayedExpansion
::rmdir /S .\merge
::pause
::mkdir .\merge
dir /b /a-d
cd .
call :treeProcess
goto :eof
pause
:treeProcess
REM rem Do whatever you want here over the files of this subdir, for example:
for %%G in (*.jpg) do (
echo %%G
echo %%H
::echo inside %%H
REM rem xcopy .\*.jpg ..\merge\ /e /Y
xcopy .\%%G ..\merge\ /Y
)
FOR /D %%H in (*20*) do (
cd %%H
rem dir /b /a-d
call :treeProcess
cd ..
echo back to ..
)
REM exit /b
REM :treeProcess
rem Do whatever you want here over the files of this subdir, for example:
REM %%G is a good choice because it does not conflict with any of the pathname format letters (a, d, f, n, p, s, t, x) and provides the longest run of non-conflicting letters for use as implicit parameters.
REM G > H > I > J > K > L > M
REM Format letters are case sensitive, so using a capital letter is also a good way to avoid conflicts %%A rather than %%a.
exit /b