请问:
任意一个批处理该加什么命令可以实现以重命名为: 已使用(*)次数.bat
任意一个批处理该加什么命令可以实现以重命名为: 已使用(*)次数.bat
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
Originally posted by pusofalse at 2008-4-20 03:56 PM:
set /a n+=1
echo. :: %n%>>%~nx0
for /f "tokens=2" %%a in (%~nx0) do set m=%%a
ren %~nx0 已使用(%m%)次%~x0
没试过。。。
[ Last edited by pusofalse on 2008-4-20 at 03:58 PM ]
:: 0
@echo off
set /p n=<%~nx0
call, set n=%n:~2%
set /a n+=1
setlocal enabledelayedexpansion
for /f "delims=" %%i in ('type %~nx0') do (
set /a m+=1
if !m! equ 1 (
echo :: !n!>%~nx0
) else (
endlocal&echo %%i>>%~nx0
)
)
ren %~nx0 已运行%N%次.bat@echo off
for /f "delims=::" %%i in (%~nx0) do set n=%%i
set /a n+=1
setlocal enabledelayedexpansion
echo :: !n!>>%~nx0
endlocal
ren %~nx0 已运行%N%次.bat
:: 0