79106991

Date: 2024-10-20 12:09:56
Score: 0.5
Natty:
Report link

Try this. Using for /r to iterate through all subdirectories and then Using %%~nxI to get the name and extension of the file.

set "folder=C:\stackoverflow\"

cd /d "%folder%"

setlocal enabledelayedexpansion

set "pattern=-"

set "replace=_"

for /r %%I in (*.txt) do (
    set "file=%%~nxI"
    ren "%%I" "!file:%pattern%=%replace%!"
)

endlocal
Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Whitelisted phrase (-1): Try this
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Ashish