bat 文件批量重命名?
2个回答
展开全部
@echo
off
color
0e
&
MODE
con:
COLS=79
LINES=25
cls&setlocal
EnableDelayedExpansion
echo.&echo.&echo.&echo.&echo.
echo
说明:
echo.&echo
使用本bat文件可批量重命名本文件所在文件夹下的所有文件
echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
set
/p
filename=
请输入新的文件名(直接以数字重命名请直接回车):
echo.&set
/p
houzhui=
请输入重命名的文件后缀类型(全部重命名请输入*):
for
/f
"delims="
%%i
in
('dir
/a-d/b
*.%houzhui%')
do
(
set/a
a+=1
)
set
b=!a!
if
!b!
GEQ
1000
GOTO
:A
IF
!b!
GEQ
100
GOTO
:B
ELSE
GOTO
:C
:A
set
a=1
for
/f
"delims="
%%j
in
('dir
/a-d/b
*.%houzhui%')
do
(
set
name=000!a!
if
not
"%%~ni"=="%~n0"
(
ren
"%%j"
"%filename%!name:~-5,4!.%houzhui%"
set/a
a+=1
)
)
echo.&echo.&echo.&echo.&echo
操作完成,按任意退出……
exit
pause
>nul
:B
set
a=1
for
/f
"delims="
%%j
in
('dir
/a-d/b
*.%houzhui%')
do
(
set
name=00!a!
if
not
"%%~ni"=="%~n0"
(
ren
"%%j"
"%filename%!name:~-4,3!.%houzhui%"
set/a
a+=1
)
)
echo.&echo.&echo.&echo.&echo
操作完成,按任意退出……
exit
pause
>nul
:C
set
a=1
for
/f
"delims="
%%j
in
('dir
/a-d/b
*.%houzhui%')
do
(
set
name=0!a!
if
not
"%%~ni"=="%~n0"
(
ren
"%%j"
"%filename%!name:~-3,2!.%houzhui%"
set/a
a+=1
)
)
echo.&echo.&echo.&echo.&echo
操作完成,按任意退出……
exit
pause
>nul
off
color
0e
&
MODE
con:
COLS=79
LINES=25
cls&setlocal
EnableDelayedExpansion
echo.&echo.&echo.&echo.&echo.
echo
说明:
echo.&echo
使用本bat文件可批量重命名本文件所在文件夹下的所有文件
echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
set
/p
filename=
请输入新的文件名(直接以数字重命名请直接回车):
echo.&set
/p
houzhui=
请输入重命名的文件后缀类型(全部重命名请输入*):
for
/f
"delims="
%%i
in
('dir
/a-d/b
*.%houzhui%')
do
(
set/a
a+=1
)
set
b=!a!
if
!b!
GEQ
1000
GOTO
:A
IF
!b!
GEQ
100
GOTO
:B
ELSE
GOTO
:C
:A
set
a=1
for
/f
"delims="
%%j
in
('dir
/a-d/b
*.%houzhui%')
do
(
set
name=000!a!
if
not
"%%~ni"=="%~n0"
(
ren
"%%j"
"%filename%!name:~-5,4!.%houzhui%"
set/a
a+=1
)
)
echo.&echo.&echo.&echo.&echo
操作完成,按任意退出……
exit
pause
>nul
:B
set
a=1
for
/f
"delims="
%%j
in
('dir
/a-d/b
*.%houzhui%')
do
(
set
name=00!a!
if
not
"%%~ni"=="%~n0"
(
ren
"%%j"
"%filename%!name:~-4,3!.%houzhui%"
set/a
a+=1
)
)
echo.&echo.&echo.&echo.&echo
操作完成,按任意退出……
exit
pause
>nul
:C
set
a=1
for
/f
"delims="
%%j
in
('dir
/a-d/b
*.%houzhui%')
do
(
set
name=0!a!
if
not
"%%~ni"=="%~n0"
(
ren
"%%j"
"%filename%!name:~-3,2!.%houzhui%"
set/a
a+=1
)
)
echo.&echo.&echo.&echo.&echo
操作完成,按任意退出……
exit
pause
>nul
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |