|
Answer» Hello,
I want to run x.bat AUTOMATICALLY and recursively in:
Code: [Select]C:\test | +---folder1 | x.bat | +---folder2 | x.bat | +---folder3 . x.bat . .----foldern x.bat Can be sequentially and simultaneously, no matter
I have this:
Code: [Select]echo off for /r /d %%x in ("*") do ( pushd "%%x" call "x.bat" popd ) pause But only runs x.bat for folder1 in a loop for the times.
Thank you very much.Try this:
Code: [Select]for /f "delims=" %%A in ('dir /b /a:d') do "%%A\x.bat" Lemonilla you NEED to use CALL. It ALSO will not launch the batch file in the ACTUAL directory - which is often required.
This should work:
Code: [Select]echo off for /r %%a in (x.bat?) do ( pushd "%%~dpa" if exist "x.bat" call "x.bat" popd ) pause
|