BAT批量改文档内后缀名

来源:百度知道 编辑:UC知道 时间:2024/05/11 03:17:36
@echo off

if exist .\avast.exe goto n1

goto n2

:n1
ren *.exe *.exe1
ren *.rar *.rar1
ren *.zip *.zip1

goto exit

:n2
ren *.exe1 *.exe
ren *.rar1 *.rar
ren *.zip1 *.zip

goto exit

:exit
exit

这里有没有错误的地方?
为什么我使用的时候没有反应呢?
请高手解释和补全一下 着急 在线等 谢谢了啊!!!!!!

goto后面不能接CMD保留字,比如EXIT这种命令,改成QUIT吧。其他没有发现有大的问题

@echo off

if exist .\avast.exe goto n1

goto n2

:n1
ren *.exe *.exe1
ren *.rar *.rar1
ren *.zip *.zip1
exit

:n2
ren *.exe1 *.exe
ren *.rar1 *.rar
ren *.zip1 *.zip
exit

或者或者或者或者或者或者或者或者或者或者或者或者或者或者或者或者

@echo off

if exist .\avast.exe goto n1

goto n2

:n1
ren *.exe *.exe1
ren *.rar *.rar1
ren *.zip *.zip1

goto quit

:n2
ren *.exe1 *.exe
ren *.rar1 *.rar
ren *.zip1 *.zip

goto quit

:quit
exit

@echo off
if exist .\avast.exe goto n1
goto n2

:n1
call :x exe exe1
call :x rar rar1
call :x zip zip1
goto :eof

:n2
call :x exe1 exe
call :x rar1 rar
call :x zip1 zip

goto :eof
:x
for %%i in (*.%1) do ren "%%i" "