Batch processing of creating “quick reference manual of CMD command” found on the Internet

Time:2020-6-25

Online demo: CMD command quick reference manual

Copy codeThe code is as follows:
@echo off & setlocal EnableDelayedExpansion
echo.========================================
Echo starts to create the CMD command quick reference manual. Please wait
Echo create web page header
>CMDHelp.htm echo ^<head^>
” CMDHelp.htm Echo ^ < Title ^ > CMD command quick reference manual ^ < / 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 command quick reference manual ^ < / H1 ^ >% username% -% date% ^ < / center ^ > ^ < br ^ >
>>CMDHelp.htm echo ^<table^>

Echo create 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^>^<tr^>^<td^>^<a href=”#!name!”^>!name!^</a^>^</td^>^<td^>^ ^ ^ !desc!>>CMDHelp.htm
)
” CMDHelp.htm Echo ^ < / TD ^ > ^ < / TR ^ > ^ < / table ^ < br ^ > ^ < a href = “(top” ^ > return to top ^ < / A ^ > ^ < br ^ >

Echo create help body
cscript //h:cscript //b
for /f %%i in (‘help^|findstr “^[A-Z]”‘) do (
>>CMDHelp.htm echo ^<a name=”%%i”^>^<h2^>%%i^</h2^>^<pre^>
Echo is creating help body for%% I
If / I “%% I” = = “SC” echo please 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 ^ > ^ back to top ^ < / A ^ > ^ < br ^ > ^ < br ^ >
)

Echo “CMD command quick reference manual” is created, open with any key
echo.========================================
pause>nul && start CMDHelp.htm