I am trying to create a very simple batch script in which for every file copied to a staging directory, the script changes its working dir to that staging directory to do some work:
pushd C:\Shared\
for /r %%f in (*.dll) do (
copy %%f C:\staging\.
pushd C:\staging\.
echo CWD is %cd%
REM do some work here
popd
)
popd
However, to my surprise, only the first pushd
gets done.
Is this a known limitation of DOS/Windows batch? If so, is there a quick workaround for this?