
CODE: [Copy to clipboard]@echo off
set folder=G:\test\资料
for %%a in (英语资料 数学资料 语文资料) do (
for /f "delims=" %%b in ('dir /b "%folder%\%%a"') do (
ren "%folder%\%%a\%%b" "%%a%%b"
)
)
| Quote: | |
|
CODE: [Copy to clipboard]@echo off & SetLocal EnableDelayedExpansion
set folder=G:\test\资料
:: 添加index变量为计数器用
set index=1
for %%a in (英语资料 数学资料 语文资料) do (
for /f "delims=" %%b in ('dir /b "%folder%\%%a"') do (
ren "%folder%\%%a\%%b" "%%a!index!"
set /a index+=1
)
rem 还原index的值:
set index=1
)
CODE: [Copy to clipboard]@echo off & SetLocal EnableDelayedExpansion
set folder=G:\test\资料
:: 添加index变量为计数器用
set index=1
for %%a in (英语资料 数学资料 语文资料) do (
for /f "delims=" %%b in ('dir /b "%folder%\%%a"') do (
ren "%folder%\%%a\%%b" "%%a!index!%%b"
set /a index+=1
)
rem 还原index的值:
set index=1
)
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |