- @echo off
- set /p copys=输入份数:
- set /p OldCharacter=输入旧字符:
- set /p NewCharacter=输入新字符:
- for /f "delims=" %%i in ('dir /b /s /a-d *%OldCharacter%*.* ^| findstr /vi "\.bat$"') do (
- set "OldName=%%~ni"
- set "folder=%%~dpi"
- setlocal enabledelayedexpansion
- set n=1
- for %%a in (%NewCharacter%) do (
- if "!n!" leq "%copys%" (
- set /a n+=1
- set "NewName=!OldName:%OldCharacter%=%%a!"
- echo copy "!folder!!OldName!%%~xi" "!folder!!NewName!%%~xi"
- copy "!folder!!OldName!%%~xi" "!folder!!NewName!%%~xi"
- )
- )
- endlocal
- )
- pause
复制代码
试试你实际使用可行不 |