An example:
FOR %%i IN (3) DO (
ECHO %%i
FOR /R "C:\backup\server%%i\temp" %%? IN (*.bak) DO (
REM some code...
)
)
Result of ECHO: 3.
Result of second FOR: the code isn’t executed.
But with:
FOR %%i IN (3) DO (
ECHO %%i
FOR /R "C:\backup\server3\temp" %%? IN (*.bak) DO (
REM some code...
)
)
Result of ECHO: 3.
Result of second FOR: the code is executed.
Any idea?
Only solution i’ve found:
Doc: http://ss64.com/nt/for_r.html
Edit: I added
PUSHD/POPDafter dbenham has answered. Thanks to him.