[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

答案

@title 更名
@echo off
color 1f
setlocal EnableDelayedExpansion
:kaishi
set /p dir=请输入路径:
if exist %dir%\*.mp3 (for %%i in (%dir%\*.mp3) do (echo %%i >>tmp.txt)) else (echo 路径错误或*.mp3不存在&goto kaishi)
for /f "delims=\-. tokens=1,2,3,4,5,6,7,8,9" %%a in (tmp.txt) do echo %%a %%b %%c %%d %%e %%f %%g %%h %%i %%j %%k %%l %%m %%n %%o %%p %%q %%r %%s %%t %%u %%v %%w %%x %%y %%z >>1.txt
for /f "delims=%%" %%a in (1.txt) do (echo %%a >>2.txt)
for /f "delims=," %%a in (2.txt) do (
set /a s=0
for %%i in (%%a) do set /a s=!s!+1
set /a s1=!s!-2
set /a s2=!s!-1
)
for /f "tokens=%s1%,%s2%" %%a in (2.txt) do (ren "%dir%\%%a - %%b.mp3" "%%b - %%a.mp3" 2>nul
ren "%dir%\%%a-%%b.mp3" "%%b-%%a.mp3" 2>nul
)
del 1.txt
del 2.txt
del tmp.txt
set /p a=文件名已经更改完毕<nul
pause
start %dir%
exit
1

评分人数

    • wxcute: 代码问题众多,且达不到预想效果。PB + 2

TOP

@title 更名
@echo off
color 1f
setlocal EnableDelayedExpansion
:kaishi
set /p dir=请输入路径:
if exist %dir%\*.mp3 (for %%i in (%dir%\*.mp3) do (echo %%i >>tmp.txt)) else (echo 路径错误或*.mp3不存在&goto kaishi)
for /f "delims=\-. tokens=1,2,3,4,5,6,7,8,9" %%a in (tmp.txt) do echo %%a %%b %%c %%d %%e %%f %%g %%h %%i %%j %%k %%l %%m %%n %%o %%p %%q %%r %%s %%t %%u %%v %%w %%x %%y %%z >>1.txt
for /f "delims=%%" %%a in (1.txt) do (echo %%a >>2.txt)
for /f "delims=," %%a in (2.txt) do (
set /a s=0
for %%i in (%%a) do set /a s=!s!+1
set /a s1=!s!-2
set /a s2=!s!-1
)
for /f "tokens=%s1%,%s2%" %%a in (2.txt) do (ren "%dir%\%%a - %%b.mp3" "%%b - %%a.mp3" 2>nul
ren "%dir%\%%a-%%b.mp3" "%%b-%%a.mp3" 2>nul
)
del 1.txt
del 2.txt
del tmp.txt
set /p a=文件名已经更改完毕<nul
pause
start %dir%
exit
1

评分人数

TOP

@title 更名
@echo off
color 1f
setlocal EnableDelayedExpansion
:kaishi
set /p dir=请输入路径格式: X:\..\.. 例如 c:\music)
if exist %dir%\*.mp3 (for %%i in (%dir%\*.mp3) do (echo %%i >>tmp.txt)) else (echo 路径错误或*.mp3不存在&goto kaishi)
for /f "delims=\-. tokens=1,2,3,4,5,6,7,8,9" %%a in (tmp.txt) do echo %%a %%b %%c %%d %%e %%f %%g %%h %%i %%j %%k %%l %%m %%n %%o %%p %%q %%r %%s %%t %%u %%v %%w %%x %%y %%z >>1.txt
for /f "delims=%%" %%a in (1.txt) do (echo %%a >>2.txt)
for /f "delims=," %%a in (2.txt) do (
set /a s=0
for %%i in (%%a) do set /a s=!s!+1
set /a s1=!s!-2
set /a s2=!s!-1

)
for /f "tokens=%s1%,%s2%" %%a in (2.txt) do (ren "%dir%\%%a - %%b.mp3" "%%b - %%a.mp3" 2>nul
ren "%dir%\%%a-%%b.mp3" "%%b-%%a.mp3" 2>nul
)
del 1.txt
del 2.txt
del tmp.txt
set /p a=文件名已经更改完毕<nul
pause
start %dir%
exit
1

评分人数

TOP

返回列表