中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-03 06:44
48,038 topics / 350,123 posts / today 1 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » [Help] How can I delete the NAME text file generated by this batch file?
Printable Version  667 / 1
Floor1 beeny Posted 2007-01-26 21:09
初级用户 Posts 49 Credits 136
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
Floor2 zhclvip Posted 2007-01-27 09:57
初级用户 Posts 50 Credits 138
@echo off
setlocal enabledelayedexpansion
set /a num=0
set /p ext=Enter the extension of the files to be batch-renamed (for example: txt):
dir /b *.%ext% >>name.txt
for /f "tokens=*" %%a in (name.txt) do (
set /a num+=1
set num=!num!.%ext%
echo %%a--^>!num!
ren "%%a" "!num!"
)
echo Batch rename completed!
pause>nul
del /f /q name.txt
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023