0

I use a batch file to rename all folders with a progressive numbers.

This code rename the folders (well) using loop function but show in loop the rest of the code that contains echo and other commands.

The code to rename must be finish to :stop and the bach file continue the execution with no loop 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 Code Not Be looped

Echo "Hello"
Pause
Echo "Hello Hello"
Pause
Echo "Hello Hello Hello"
Pause
placidomaio
  • 111
  • 1
  • 13

0 Answers0