Online demonstration: CMD command quick query manual
Copy codeThe Code is as follows: @ echo off & setlocal EnableDelayedExpansion
Echo. ==========================================================
Echo starts to create the CMD command quick query manual. Please wait ......
Echo creates a webpage file header ......
> CMDHelp.htm echo ^ > CMDHelp.htm echo ^ <title ^> CMD command quick query manual ^ </title ^>
> CMDHelp.htm echo ^ <meta http-equiv = "Content-Type" content = "text/html ^; charset = gb2312" ^/^>
> CMDHelp.htm echo ^ > CMDHelp.htm echo ^ <a name = "Top" ^>
> CMDHelp.htm echo ^ <center ^> ^
> CMDHelp.htm echo ^ <table ^>
Echo creates a help directory ......
For/f "delims =:" % f in ('help ^ | findstr/n "^ ASSOC" ') do set head = % f
Set/a head-= 1
If "% head %" = "0" (set head =) else set head = skip = % head %
For/f "% head % delims =" % I in ('help') do (
Set str = % I & set name =! Str :~ 0, 9! & Set desc =! Str :~ 9!
Echo .! Name! | Findstr/v "^ [A-Z]"> nul & echo! Desc! > CMDHelp.htm
If errorlevel 1 echo ^ </td ^> ^ </tr ^> ^ <td ^> ^ <a href = "#! Name! "^>! Name! ^ </A ^> ^ </td ^> ^ <td ^> ^! Desc!> CMDHelp.htm
)
> CMDHelp.htm echo ^ </td ^> ^ </tr ^> ^ </table ^> ^ <br ^> ^ <a href = "# top" ^> Back to top ^ </a ^> ^ <br ^>
Echo creates the help body ......
Cscript // h: cscript // B
For/f % I in ('help ^ | findstr "^ [A-Z]" ') do (
> CMDHelp.htm echo ^ <a name = "% I" ^> ^
Echo is creating the help body of % I ......
If/I "% I" = "SC" echo Press Y to continue ......
Help % I | findstr "<. *>"> nul
If not errorlevel 1 (
For/f "delims =" % a in ('help % I ') do (
Set st = % a & set st =! St: ^ <= ^ <! & Set st =! St: ^> = ^>!
Echo! St!> CMDHelp.htm
)
) Else help % I> CMDHelp.htm
> CMDHelp.htm echo ^ </pre ^> ^ <a href = "# top" ^> Back to top ^ </a ^> ^ <br ^>
)
Echo CMD command quick query manual is created. Open any key
Echo. ==========================================================
Pause> nul & start CMDHelp.htm