- @echo off & SetLocal EnableDelayedExpansion
- set /p p=输入1改名,输入2还原:
- if "%p%"=="2" goto 2
- set Str=abcdefghijklmnopqrstuvwxyz0123456789
-
- for /f "delims=" %%a in ('dir /b') do (echo %%a
- for /l %%l in (1 1 12) do (
- set /a n = !random! %% 36
- call set r=%%str:~!n!,1%%!r!
- )
- if not "%%a"=="%~nx0" (
- if not "%%a"=="文件名.txt" (
- ren "%%a" !r!
- echo %%a^|!r! >>文件名.txt
- )
- )
- set r=
- )
- pause
- exit
-
- :2
- for /f "tokens=1,2 delims=|" %%a in (文件名.txt) do (ren %%b %%a)
- del 文件名.txt
- pause
复制代码
|