CODE: [Copy to clipboard]
@echo off
echo.
echo 需要grep/sed/ConvertZ 8.02/wget等软件配合
echo 请到http://gnuwin32.sourceforge.net/下载上面几个软件并安装
echo.
pause
set Wget_Path=C:\Program Files\GnuWin32\bin
path %Wget_path%;E:\software\小工具\ConvertZ 8.02;%path%
wget "http://www.cn-dos.net/forum/viewthread.php?tid=27667&action=printable" -O index.html
rem utf8编码转gbk
start /wait ConvertZ /i:utf8 /o:gbk /f:s index.html
grep ">可打印版本<" index.html >tmp1.txt
grep -o tid=[0-9][0-9]* tmp1.txt >tmp2.txt
grep -o [0-9][0-9]* tmp2.txt >tmp3.txt
md bat
cd bat
md images
cd images
md default
cd default
wget http://www.cn-dos.net/forum/images/default/logo.gif
cd ..
cd ..
for /f %%f in (..\tmp3.txt) do (
IF NOT EXIST viewthread_%%f.html (
wget "http://www.cn-dos.net/forum/viewthread.php?tid=%%f&action=printable" -O viewthread_%%f.html
start /wait ConvertZ /i:utf8 /o:gbk /f:s viewthread_%%f.html
grep "打印本页" viewthread_%%f.html >tmp1.txt
sed "s/<b>标题: <\/b>//g;s/ <a.*//g" tmp1.txt >tmp2.txt
for /f %%i in (.\tmp2.txt) do rpl "<title>中国DOS联盟论坛 - Powered by Discuz! Board</title>" "<title>%%i</title>" viewthread_%%f.html
)
)
move /Y ..\index.html
然后用工具替换一下index.html中的url地址就行了。