Below is a batch file for renaming files in bulk. I also want to achieve the following functions, please ask an expert for help:
1 Delete the generated NAME text file
2 If I don't know the file type, how can I determine it
3 Long filenames can't be renamed, I don't know how to solve that!
@echo off
setlocal enabledelayedexpansion
set /a num=0
dir *.jpg >>name.txt
for /f "skip=5 tokens=4" %%a in (name.txt) do (
set yum=%%a
set /a num+=1
set num=!num!.jpg
call :start %%a !num!
)
:start
ren %1 %2
goto eof
1 Delete the generated NAME text file
2 If I don't know the file type, how can I determine it
3 Long filenames can't be renamed, I don't know how to solve that!
@echo off
setlocal enabledelayedexpansion
set /a num=0
dir *.jpg >>name.txt
for /f "skip=5 tokens=4" %%a in (name.txt) do (
set yum=%%a
set /a num+=1
set num=!num!.jpg
call :start %%a !num!
)
:start
ren %1 %2
goto eof
