cmd脚本构造htm文件-----Net 命令速查手册

@echo off
del net_help.htm 2>nul
echo.===============================
echo......请稍候,构造htm文件中.....
echo.===============================
setlocal  ENABLEDELAYEDEXPANSION
for /f "tokens=1,2 delims=:" %%i in ('net help^|more +9^|findstr /n "."') do (
set n=%%j
if %%i gtr 0 (if %%i lss 10 (
echo !n:~3,22!>>tmp.txt
echo !n:~28,14!>>tmp.txt
echo !n:~50,14!>>tmp.txt
)
)
)

for /f "delims=" %%i in ('sort tmp.txt') do (
set x=%%i
set x=!x: =!
set x=!x:CONFIGWORKSTATION=CONFIG WORKSTATION!
set x=!x:CONFIGSERVER=CONFIG SERVER!
set x=!x:NET=NET !
echo !x!>>tmp1.txt
)

endlocal

>net_help.htm echo ^<head^>
>>net_help.htm echo ^<title^>Help for Net commands^</title^>
>>net_help.htm echo ^<meta http-equiv="Content-Type" content="text/html^; charset=gb2312" ^/^>
>>net_help.htm echo ^</head^>
>>net_help.htm echo ^<A NAME="Top"^>
>>net_help.htm echo ^<center^>
>>net_help.htm echo ^<h1^>Net 命令速查手册^</h1^>
>>net_help.htm echo Written by Hitme
>>net_help.htm echo ^</center^>

for /f "delims=" %%i in (tmp1.txt) do (
>>net_help.htm echo ^<a href="#%%i"^>%%i^</a^>
>>net_help.htm echo ^</br^>
)

for /f "delims=" %%i in (tmp1.txt) do (
>>net_help.htm echo ^<a name="%%i"^>
>>net_help.htm echo ^<h2^>%%i^</h2^>
>>net_help.htm echo ^<pre^>
%%i /help|more /s>>net_help.htm
>>net_help.htm echo ^</pre^>
>>net_help.htm echo ^<a href="#top"^>返回页首^</a^>
)
del tmp*.txt
start net_help.htm

posted on 2008-10-21 21:15  starspace  阅读(234)  评论(0编辑  收藏  举报

导航