谢谢作者: 2012duanyongli 时间: 2015-12-18 16:31
这个挺复杂,好在没白忙活。
@echo off
setlocal enabledelayedexpansion
del *.txt
del ren.bat
dir /b *.mp3|find /i "acnnn" >ren0.txt
dir /b *.mp3|find /i "asfghj" >>ren0.txt
:清除重复行(行首不能有空格)
for /f "delims=" %%i in ('type ren0.txt') do (if not defined %%i set %%i=A & echo %%i>>ren1.txt)
:删除字符串
for /f "delims=" %%1 in ('type "ren1.txt"')do set setin=%%1&set change=!setin:acnnn=!&echo !change!>>ren2.txt
for /f "delims=" %%1 in ('type "ren2.txt"')do set setin=%%1&set change=!setin:asfghj=!&echo !change!>>ren3.txt
:合并两个文档
set n1=0
for /f "delims=" %%a in (ren1.txt) do (
set /a n1=n1+1
set n2=0
for /f "delims=" %%b in (ren3.txt) do (
set /a n2=n2+1
if !n1! equ !n2! (
echo ren %%a %%b>>ren.bat
)
)
)
:最后更改文件名
ren.bat作者: dos时代菜鸟 时间: 2015-12-18 19:03 本帖最后由 dos时代菜鸟 于 2015-12-21 08:13 编辑