回复 4# 暴雪英雄
- @echo off
- rem 批处理保存为ansi编码格式
- rem 下载pdftk http://bcn.bathome.net/tool/PDFtk.rar
-
- set "file=d:\空白页文件夹\空白页.pdf"
- set "_pdftk=d:\pdftk\pdftk.exe"
-
- cd /d "%~dp0"
- setlocal enabledelayedexpansion
- for %%a in (*.pdf) do (
- set /a n+=1
- )
- for /f "delims=" %%i in ('dir /b /a-d *.pdf') do (
- set /a m+=1
- if !m! neq !n! (
- "%_pdftk%" "%%i" dump_data |findstr /rbec:"NumberOfPages:.*[13579]" 1>nul && (
- set str=!str! "%%i" "%file%"
- ) || (
- set str=!str! "%%i"
- )
- ) else (
- set str=!str! "%%i"
- )
- )
- for %%i in (.) do (
- echo 合并 !str!
- "%_pdftk%" !str! cat output "%%~nxi.pdf"
- )
- endlocal
- pause
复制代码
|