- @echo off & setlocal enabledelayedexpansion
- set "rarpath=C:\Program Files\WinRAR\rar.exe"
- set "af=abc.rar"
- set "bf=abc.txt" & set "name=!bf:~,-4!"
- set n=1
- set "tf=%bf%"
- :loop
- cls
- ("%rarpath%" a -o- "%af%" "!tf!") && goto end || set /a n+=1 & ren "!tf!" "!name!(!n!).txt" & set "tf=!name!(!n!).txt") & goto loop
- :end
- ren "!tf!" "!bf!"
- pause & exit
复制代码
|