(view source code of jthelp.bat as plain text)
@ECHO OFF
IF "%OS%"=="Windows_NT" SETLOCAL
:: Version number for this batch file
SET MyVer=1.01
:: Display "about"
ECHO.
ECHO JTHelp.bat, Version %MyVer% for Windows 2000 / XP
ECHO Generate an HTML help file for Microsoft's JT scheduler tool
ECHO.
ECHO This batch file was written by Rob van der Woude
ECHO http://www.robvanderwoude.com
ECHO.
ECHO JT.EXE is part of Microsoft's Windows 2000 Resource Kit and
ECHO is available at ftp://ftp.microsoft.com/reskit/win2000/jt.zip
ECHO.
ECHO.
ECHO.
IF NOT "%OS%"=="Windows_NT" SET MyVer=
IF NOT "%OS%"=="Windows_NT" GOTO End
:: Check if JT.EXE is available and if not, offer to download it
ECHO Checking availability of JT scheduler tool . . .>CON
SET JTAvailable=
SET Download=
JT.EXE /? >NUL 2>&1
IF ERRORLEVEL 1 (
SET JTAvailable=No
ECHO.>CON
ECHO This batch file requires Microsoft's JT utility.>CON
SET /P Download=Do you want to download it now? [y/N] >CON
)
:: Start download if requested
IF /I "%Download%"=="Y" (
START "JT" "ftp://ftp.microsoft.com/reskit/win2000/jt.zip"
ECHO.>CON
ECHO Install the downloaded file and make sure JT.EXE is in the PATH.>CON
ECHO Then try again.>CON
)
:: Abort if JT.EXE is not available yet
IF "%JTAvailable%"=="No" GOTO End
ECHO Writing HTML header . . .>CON
> jthelp.htm ECHO ^<HTML^>
>>jthelp.htm ECHO ^<HEAD^>
>>jthelp.htm ECHO ^<TITLE^>Help for Microsoft's JT scheduler tool^</TITLE^>
>>jthelp.htm ECHO ^<META NAME="generator" CONTENT="JTHelp.bat, Version %MyVer%, by Rob van der Woude"^>
>>jthelp.htm ECHO ^</HEAD^>
>>jthelp.htm ECHO.
>>jthelp.htm ECHO ^<BODY^>
>>jthelp.htm ECHO.
>>jthelp.htm ECHO ^<A NAME="Top"^>
>>jthelp.htm ECHO.
>>jthelp.htm ECHO ^<H1 ALIGN="center"^>Help for Microsoft's JT scheduler tool^</H1^>
>>jthelp.htm ECHO.
>>jthelp.htm ECHO ^<P^>^ ^</P^>
>>jthelp.htm ECHO.
ECHO Writing JT main help . . .>CON
SET EOH=0
>>jthelp.htm ECHO ^<P^>
FOR /F "tokens=1* delims=]" %%A IN ('JT.EXE /? 2^>^&1 ^| FIND.EXE /N /V ""') DO CALL :CmdHdr "%%~B" >>jthelp.htm
>>jthelp.htm ECHO ^</P^>
>>jthelp.htm ECHO ^<TABLE^>
FOR /F "tokens=1* delims=-" %%A IN ('JT.EXE /? ^| FIND.EXE " - "') DO CALL :Parse "%%~A" "%%~B" >>jthelp.htm 2>NUL
>>jthelp.htm ECHO ^</TABLE^>
ECHO Writing footer . . .>CON
>>jthelp.htm ECHO.
>>jthelp.htm ECHO ^<P^>^ ^</P^>
>>jthelp.htm ECHO.
>>jthelp.htm ECHO ^<CENTER^>
>>jthelp.htm ECHO ^<P^>This HTML help file and the associated text files were generated by:^<BR^>
>>jthelp.htm ECHO ^<B^>JTHelp.bat^</B^>, Version %MyVer%^<BR^>
>>jthelp.htm ECHO JTHelp.bat was written by Rob van der Woude^<BR^>
>>jthelp.htm ECHO ^<A HREF="http://www.robvanderwoude.com"^>http://www.robvanderwoude.com^</A^>^</P^>
>>jthelp.htm ECHO.
>>jthelp.htm ECHO ^<P^>^ ^</P^>
>>jthelp.htm ECHO.
>>jthelp.htm ECHO ^<P^>JT.EXE is part of Microsoft's Windows 2000 Resource Kit^<BR^>
>>jthelp.htm ECHO Download location: ^<A HREF="ftp://ftp.microsoft.com/reskit/win2000/jt.zip"^>ftp://ftp.microsoft.com/reskit/win2000/jt.zip^</A^>^</P^>
>>jthelp.htm ECHO ^</CENTER^>
>>jthelp.htm ECHO.
>>jthelp.htm ECHO ^</BODY^>
>>jthelp.htm ECHO ^</HTML^>
ECHO Done, now opening HTML file . . .>CON
START jthelp.htm
ENDLOCAL
GOTO:EOF
:CmdHdr
ECHO.%1 | FINDSTR.EXE /R /I "[\@/]" >NUL && SET EOH=1
IF "%EOH%"=="1" GOTO:EOF
IF NOT "%~1"=="" ECHO.%~1^<BR^>
IF "%~1"=="" ECHO.^</P^>
GOTO:EOF
:Parse
:: JT dommand
ECHO ^<TR^>
SET Command=%1
:: Escape special characters
SET Command=%Command:<=^<%
SET Command=%Command:>=^>%
SET Command=%Command:|=^¦%
:: Strip (most) trailing spaces
SET Command=%Command: = %
SET Command=%Command: = %
SET Command=%Command: = %
SET Command=%Command: = %
:: Get first word in line and use it as the JT command name
FOR /F "tokens=1 delims=/<|&> " %%a IN ('ECHO.%Command:"=%') DO SET Name=%%a
IF "%Name%"=="?" SET Name=Help
CALL :LoCase Name
:: Create a separate text file for detailed help on each JT command
ECHO Writing JT help text for %Name% command . . .>CON
JT.EXE /? %Name% > jt_%Name%.txt 2>&1
:: Append "Back" instruction to JT command text
>> jt_%Name%.txt ECHO.
>> jt_%Name%.txt ECHO.
>> jt_%Name%.txt ECHO.
>> jt_%Name%.txt ECHO.
>> jt_%Name%.txt ECHO.
>> jt_%Name%.txt ECHO.
>> jt_%Name%.txt ECHO Click the Back button or press Backspace to return to the JT main page . . .
:: Write HTML formated JT command
ECHO ^<TD^>^<A HREF="jt_%Name%.txt"^>^<CODE^>%Command:"=%^</CODE^>^</A^>^</TD^>
:: JT command description
SET Descr=%2
:: Escape special characters
SET Descr=%Descr:<=^<%
SET Descr=%Descr:>=^>%
SET Descr=%Descr:|=^¦%
SET Descr=%Descr:(=^(%
SET Descr=%Descr:)=^)%
:: Write HTML formated JT command description
ECHO ^<TD^>%Descr:"=%^</TD^>
ECHO ^</TR^>
GOTO:EOF
:LoCase
:: Rename file to all lowercase
SET TempVarName=%1
CALL SET TempVarVal=%%%1%%
SET TempVarVal=%TempVarVal:A=a%
SET TempVarVal=%TempVarVal:B=b%
SET TempVarVal=%TempVarVal:C=c%
SET TempVarVal=%TempVarVal:D=d%
SET TempVarVal=%TempVarVal:E=e%
SET TempVarVal=%TempVarVal:F=f%
SET TempVarVal=%TempVarVal:G=g%
SET TempVarVal=%TempVarVal:H=h%
SET TempVarVal=%TempVarVal:I=i%
SET TempVarVal=%TempVarVal:J=j%
SET TempVarVal=%TempVarVal:K=k%
SET TempVarVal=%TempVarVal:L=l%
SET TempVarVal=%TempVarVal:M=m%
SET TempVarVal=%TempVarVal:N=n%
SET TempVarVal=%TempVarVal:O=o%
SET TempVarVal=%TempVarVal:P=p%
SET TempVarVal=%TempVarVal:Q=q%
SET TempVarVal=%TempVarVal:R=r%
SET TempVarVal=%TempVarVal:S=s%
SET TempVarVal=%TempVarVal:T=t%
SET TempVarVal=%TempVarVal:U=u%
SET TempVarVal=%TempVarVal:V=v%
SET TempVarVal=%TempVarVal:W=w%
SET TempVarVal=%TempVarVal:X=x%
SET TempVarVal=%TempVarVal:Y=y%
SET TempVarVal=%TempVarVal:Z=z%
SET %TempVarName%=%TempVarVal%
GOTO:EOF
:End
IF "%OS%"=="Windows_NT" ENDLOCAL
page last modified: 2024-04-16; loaded in 0.0128 seconds