@echo off

if not exist XSET.EXE goto NOTFOUND
if not exist XSET.TXT goto NOTFOUND

if "%1" == "second_time" goto begin

:: Run a new shell with environment big enough (10,000 bytes to be sure)
command /e:10000/c %0 second_time
goto end    

:NOTFOUND
echo:
echo  Error: you must be in the directory containing XSET.EXE and XSET.TXT
echo:
pause
goto EXIT

:begin
echo:
echo  Do you want to see the documentation on the screen
echo           or to print it onto the printer ?
echo  Warning: it is very long

XSET/COLOR HIGHLIGHT/PROMPT " Hit S for screen, P for printer"/UPPER _k KEY "SP"
echo:
goto %_k%

:S  screen 
more < xset.txt
goto end

:P  printer

echo  Please choose printer:   P  prn
echo                           1  lpt1
echo                           2  lpt2
echo                           3  lpt3
echo                           4  lpt4
echo                           O  other
XSET/UPPER _k KEY "P1234O"
if "%_k%" == "O" goto input
set _k=lpt%_k%
if "%_k%" == "lptP" set _k=prn

:print                 
copy xset.txt %_k% > nul
goto end

:input
set _k=lpt1
XSET/COLOR HIGHLIGHT/DEFAULT/PROMPT " Choose printer: " _k
echo:                
if not "%_k%" == "" goto print

:end
set _k=

echo     Run the batch file DEMO.BAT to have an example of the power of XSET.

:exit