本帖最后由 Five66 于 2023-12-23 05:40 编辑
不知行否.不包括子目录和子目录文件- @echo off&chcp 936
- for %%a in (*) do (
- set oldfile=%%a
- for /f "eol=/ delims=" %%b in ('dir /b "%%a"') do (
- set newfile=%%b
- setlocal enabledelayedexpansion
- rename "!oldfile!" "!newfile:?=!"
- endlocal
- )
- )
-
- for /d %%a in (*) do (
- set oldfile=%%a
- for /f "eol=/ delims=" %%b in ('dir /b "%%a?"') do (
- set newfile=%%b
- setlocal enabledelayedexpansion
- rename "!oldfile!" "!newfile:?=!"
- endlocal
- )
- )
- pause
复制代码
|