79231802

Date: 2024-11-27 20:38:14
Score: 0.5
Natty:
Report link

Alright. I have done it.

@echo off
setlocal enabledelayedexpansion

rem Loop through existing .xhtml files in reverse order
for /L %%i in (478, -1, 0) do (
    if exist %%i.xhtml (
        set /a newnum=%%i + 1

        rem Attempt to rename the file
        ren %%i.xhtml !newnum!.xhtml
    )
)

endlocal

Make sure to indicate the highest number name in the code. My was 478.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: bobby324