|
|
发表于 2024-5-22 19:51:36
|
显示全部楼层
保存为ansi或gbk编码的bat
- @echo off&pause
- set "@self=%~nx0"
- chcp 437>nul
- setlocal enabledelayedexpansion
- set aaa=1
- for /f "eol=/ delims=" %%i in ('dir /b') do (
- if "!aaa!" == "%aaa%" endlocal&chcp 936>nul
- set /a ccc+=1
- set @file=%%i
- call set @file%%ccc%%=%%@file%%
- )
- for /f "eol=/ delims=" %%i in ('dir /b') do (
- set /a bbb+=1
- set @file=%%i
- setlocal enabledelayedexpansion
- for %%c in (!bbb!) do (
- if "!@file!" neq "!@self!" (
- echo,rename "!@file!" to "!@file%%c:?=!"
- rename "!@file!" "!@file%%c:?=!"
- )
- )
- endlocal
- )
- pause&exit/b
复制代码 |
|