- @echo off & if "%1"=="" exit
- pushd %1
- for /f %%a in ('dir /b /ad') do set /a n+=1
- :loop
- for /f "delims=" %%a in ('dir /s /b /ad') do (
- ren "%%a" "%~n1-%%~na"
- cd "%~n1-%%~na"
- goto loop
- )
- cd %1
- set /a m+=1
- if not "%m%"=="%n%" goto loop
- for /f "delims=" %%a in ('dir /b *.txt') do ren "%%a" "%~n1-%%~nxa"
- pause
复制代码 Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\shell\ren\command]
@="C:\\Users\\Administrator\\Desktop\\test.bat %1" |