bat的介绍

创业资料 浏览

bat的介绍

BAT是中国互联网公司百度公司(Baidu)、阿里巴巴集团(Alibaba)、腾讯公司(Tencent)三大巨头首字母缩写。

bat学习资料(有劳整理成书,谢~)

把下面的指令放在批处理运行,会得到你想要的。

@echo off

del CMD命令速查手册.htm >nul

echo.===============================

echo......请稍候,构造htm文件中.....

echo.===============================

>CMD命令速查手册.htm echo ^<head^>

>>CMD命令速查手册.htm echo ^<title^>CMD命令速查手册^</title^>

>>CMD命令速查手册.htm echo ^<meta http-equiv=Content-Type content=text/html^; charset=gb2312 ^/^>

>>CMD命令速查手册.htm echo ^</head^>

>>CMD命令速查手册.htm echo ^<A NAME=Top^>

>>CMD命令速查手册.htm echo ^<center^>

>>CMD命令速查手册.htm echo ^<h1^>CMD 命令速查手册^</h1^>

>>CMD命令速查手册.htm echo Written by junluck    %date%

>>CMD命令速查手册.htm echo ^</center^>

>>CMD命令速查手册.htm echo ^<br^>

ver|find Windows XP && goto:joke

for /f tokens=1* %%i in ('help^|more +3') do (

help %%i>nul && echo ^<a href=#%%i^>%%i^</a^>^ ^ %%j >>CMD命令速查手册.htm || echo ^ ^ ^ ^  %%i %%j>>CMD命令速查手册.htm

>>CMD命令速查手册.htm echo ^</br^>

)

for /f  %%i in ('help^|more +3') do (

help %%i>nul && (

>>CMD命令速查手册.htm echo ^<a name=%%i^>

>>CMD命令速查手册.htm echo ^<h2^>%%i^</h2^>

>>CMD命令速查手册.htm echo ^<pre^>

help %%i>>CMD命令速查手册.htm

>>CMD命令速查手册.htm echo ^</pre^>

>>CMD命令速查手册.htm echo ^<a href=#top^>返回页首^</a^>

)

)

start CMD命令速查手册.htm

goto:eof

:joke

for /f tokens=1* %%i in ('help^|more +1') do (

help %%i>nul && echo ^ ^ ^ ^  %%i %%j>>CMD命令速查手册.htm || echo ^<a href=#%%i^>%%i^</a^>^ ^ %%j >>CMD命令速查手册.htm 

>>CMD命令速查手册.htm echo ^</br^>

)

for /f  %%i in ('help^|more +1') do (

help %%i>nul || (

>>CMD命令速查手册.htm echo ^<a name=%%i^>

>>CMD命令速查手册.htm echo ^<h2^>%%i^</h2^>

>>CMD命令速查手册.htm echo ^<pre^>

help %%i>>CMD命令速查手册.htm

>>CMD命令速查手册.htm echo ^</pre^>

>>CMD命令速查手册.htm echo ^<a href=#top^>返回页首^</a^>

)

)

start CMD命令速查手册.htm

CODE:  [Copy to clipboard]

--------------------------------------------------------------------------------

:: CMDHelp.cmd - Gather commands' help of CMD to HTML

:: Author: junluck

:: Modify: Will Sort - - CMD@WinXP

@echo off & setlocal

echo.========================================

echo 开始创建《CMD命令速查手册》,请稍候……

echo 创建网页文件头……

>CMDHelp.htm echo ^<head^>

>>CMDHelp.htm echo    ^<title^>CMD命令速查手册^</title^>

>>CMDHelp.htm echo    ^<meta http-equiv=Content-Type content=text/html^; charset=gb2312 ^/^>

>>CMDHelp.htm echo ^</head^>

>>CMDHelp.htm echo ^<A NAME=Top^>

>>CMDHelp.htm echo ^<center^>^<h1^>CMD 命令速查手册^</h1^>junluck - %date%^</center^>^<br^>

>>CMDHelp.htm echo ^<table^>

ver | findstr XP>nul && set head=1 || set head=3

echo 创建帮助目录……

for /f tokens=1* skip=%head% %%i in ('help') do (

    echo %%i %%j | findstr /v ^[A-Z] >>CMDHelp.htm

    if errorlevel 1 echo ^</td^>^</tr^>^<tr^>^<td^>^<a href=#%%i^>%%i^</a^>^</td^>^<td^>^ ^ ^ %%j>>CMDHelp.htm

)

>>CMDHelp.htm echo ^</td^>^</tr^>^</table^>^<br^>^<a href=#top^>返回页首^</a^>^<br^>

echo 创建帮助正文……

for /f  %%i in ('help^|findstr ^[A-Z]') do (

    echo    获取命令 %%i 帮助文档……

    >>CMDHelp.htm echo ^<a name=%%i^>^<h2^>%%i^</h2^>^<pre^>

    help %%i>>CMDHelp.htm

    >>CMDHelp.htm echo ^</pre^>^<a href=#top^>返回页首^</a^>^<br^>^<br^>

)

echo 《CMD命令速查手册》创建完毕,任意键打开

echo.========================================

pause>nul && start CMDHelp.htm

转载请注明:亿家范文网 » bat的介绍