Batch file to rename folders goto command loop the rest of the code
0
I use a batch file to rename all folders with progressive numbers. This code renames the folders well using loop function, but it loops the rest of the code that contains echo and other commands. The code to rename must finish until :stop and the batch file continue the execution without looping the rest of the code with other commands. :: Rename Folders Code @Echo off Pushd "D:Programmi Installati" || (Echo couldn't change dir&pause&goto :stop) set Cnt=0 for /f "delims=" %%A in ( 'dir /B /AD log* ^| findstr /iV "^log_[0-9][0-9]*$" ' ) Do Call :RenInc "%%A" PopD Goto :stop :RenInc Set /A Cnt+=1 if Exist "log_%Cnt%" goto :RenInc Ren "%~1" "log_%Cnt%" ) :stop :: Other Part Of Code, This Part Of ...