回复 1# qd2024
1.bat- @echo off
- chcp 65001 >nul
- REM 根据需要自行添加文件类型
- set "FileTypes=pdf doc xls ppt"
- set "NewFolder=结果文件夹"
- cd /d "%~dp0"
- md "%NewFolder%" 2>nul
- for /f "delims=" %%i in ('dir /b /a-d *.txt') do (
- echo %%i
- for %%j in (%FileTypes%) do (
- if exist "%%~ni.%%j" (
- for /f "delims=" %%k in ('type "%%i"') do (
- copy "%%~ni.%%j" "%NewFolder%\%%~ni%%k.%%j"
- )
- )
- )
- )
复制代码
|