ren_nofor.bat

来自「高手lxmxn收集的批处理。包括了批处理教程和他写的几十个很经典的代码。」· Batch 代码 · 共 24 行

BAT
24
字号
::Code by lxmxn @ bbs.cn-dos.net
::将C盘下所有的a.abc文件重命名为a.bcd,要求不能用for命令
::Date 15:06 2007-1-11

@echo off
:begin
    set file=%random%
    if exist %file% goto begin
    dir /s/b/a-d c:\a.abc 2>nul >%file%
:loop
    set a=
    set /p a=<%file%
    rem if "%a%"==" " goto :end
    if "%a%"=="" goto :end
    del "%a%"
    set a=%a:\=\\%
    findstr /v /c:"%a%" %file% >%file%_
    del %file%
    echo ren %file%_ %file%
    rem ping -n 1 127.1 >nul
goto loop
:end
del %file%
pause

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?