Rename text file based on content
Moderator: DosItHelp
Re: Rename text file based on content
hey i send you a PM
Re: Rename text file based on content
I had a look at a few files. Some have illegal filename characters in the first section so they will fail to rename.
Some will have trailing spaces, as the format is not consistent, but try this.
Some will have trailing spaces, as the format is not consistent, but try this.
Code: Select all
@echo off
for /f "delims=" %%a in ('dir *.txt /b /a-d ') do call :next "%%a"
pause
goto :EOF
:next
set /p "var="<"%~1"
for /f "delims=/," %%b in ("%var%") do ren "%~1" "%%b%~x1"