- 帖子
- 7
- 积分
- 19
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2021-8-1
|
@echo off
for %%i in (%~dp0.) do set folder0=%%~ni
setlocal enabledelayedexpansion
set x=100
for %%i in (*) do (
set /a x+=1
ren "%%i" "%folder0%!x:~1!%%~xi"
)
for /d %%a in (*) do (
ren "%%a" "%folder0%%%a"
pushd "%folder0%%%a"
set n=100
for /d %%b in (*) do (
set m=100
set /a n+=1
ren "%%b" "%folder0%%%a!n:~1!"
for %%c in ("%folder0%%%a!n:~1!\*") do (
set /a m+=1
ren "%%c" "%folder0%%%a!n:~1!-!m:~1!%%~xc"
)
set m=100
)
set n=100
popd
)
@echo off
setlocal ENABLEDELAYEDEXPANSION
for /f %%i in ('dir /b /ad') do (
set /a num=0
for /f %%x in ('dir /b %%i\*.*') do (
set /a num+=1
echo %%i\%%x 重命名为 %%i^-0!num!^.*
ren "%%i\%%x" "%%i^-0!num!^.*"
))
pause
加进第3、4行,还加了原有的一段,达到了预想的效果,谢谢!嘿嘿,就是连批处理命令自己也被重命名。这已经很好了,谢谢! |
|