echo off
goto install
:docopy
if exist %d:\%cname goto trycopy
beep ^ echo.
echo Warning:  %cname is not on the diskette, 4DOS may not install correctly
echo. ^ return
:trycopy
if not exist %cname goto copyOK
echo. ^ input %cname already exists -- overwrite it (Y = yes)? %%over_write
if not "%over_write"=="Y" return
:copyOK
copy %d:\%cname
return
:install
if "%inst4d" == "G" goto go_install
if "%inst4d" == "S" goto start_install
if "%1"=="" set d=a
if not "%1"=="" set d=%1
set inst4d=S
%d%:\4dos88.exe /E=4096 /c %d%:\install
set inst4d=
echo Please wait ...
goto done
:start_install
if "%d" = "%disk" goto go_install
copy %d:\install.bat >& nul ^ setlocal ^ set path= ^ set inst4d=G
call install
del install.bat >& nul ^ endlocal ^ cls ^ quit
:go_install
set startdir=%cwd ^ cls ^ screen 2 0 ^ text
    ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
    º                                                                   º
    º  Welcome, and thanks for trying 4DOS!                             º
    º                                                                   º
    º  INSTALL will guide you through the 4DOS installation process.    º
    º  You will first be prompted for:                                  º
    º                                                                   º
    º      The disk drive and directory where you wish to install 4DOS  º
    º      The disk drive and directory where you wish to install the   º
    º         utilities and auxiliary files                             º
    º      The swapping mode (EMS, disk, or none)                       º
    º      The processor type (if an 80286 or 80386)                    º
    º                                                                   º
    º  Press any key when you are ready to continue...                  º
    º                                                                   º
    ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ¼
endtext
screen 15 55 ^ inkey %%var ^ cls ^ set boot=C:\
set prog=4DOS.COM ^ set ansi=ANSI.SYS ^ set keystack=KEYSTACK.SYS
if not exist %d:\4dos.arc goto registered
set share=Y
cls ^ screen 1 0 ^ text
    ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
    º                                                                   º
    º  This is a shareware copy of 4DOS.                                º
    º                                                                   º
    º  You may try 4DOS for up to 21 days before deciding whether you   º
    º  want to keep it and pay the registration fee.  After the 21      º
    º  days is up you are legally required to either register 4DOS      º
    º  or stop using it, as specified in the 4DOS license agreement.    º
    º                                                                   º
    º  For more information on registration and the 4DOS license        º
    º  agreement, see pages ii - viii in the manual, or the file        º
    º  REGISTER.FRM.                                                    º
    º                                                                   º
    º  Because this copy is shareware, you may make additional copies   º
    º  of this disk and distribute them to others, provided you         º
    º  include all the files.  Please remind those you give 4DOS to     º
    º  of the registration requirements and how the shareware system    º
    º  works.                                                           º
    º                                                                   º
    º  Press any key when you are ready to continue...                  º
    º                                                                   º
    ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ¼
endtext
screen 20 55 ^ inkey %%var ^ goto getdirs
:registered
set share=N
cls ^ screen 2 0 ^ text
    ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
    º                                                                   º
    º  This is a registered copy of 4DOS.                               º
    º                                                                   º
    º  This copy is for use on your computer system only.  It may be    º
    º  used only on a single computer, unless you have purchased a      º
    º  network, site, or corporate license.  It may not be distributed  º
    º  to others.                                                       º
    º                                                                   º
    º  If you have purchased an individual copy of 4DOS you have also   º
    º  received a shareware diskette.  The copy of 4DOS on the          º
    º  shareware diskette may be copied and given to others to try,     º
    º  under the terms of the 4DOS license agreement.                   º
    º                                                                   º
    º  The 4DOS license agreement and registration information are      º
    º  on pages ii - viii of the manual, and in the file REGISTER.FRM   º
    º  on the shareware diskette.                                       º
    º                                                                   º
    º  Press any key when you are ready to continue...                  º
    º                                                                   º
    ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ¼
endtext
screen 20 55 ^ inkey %%var
:getdirs
cls ^ screen 2 0 ^ text
    ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
    º                                                                    º
    º  Enter the disk drive and directory where you would like to        º
    º  install the 4DOS program files (generally this should be the      º
    º  root directory of your boot drive):                               º
    º                                                                    º
    º                                                                    º
    º                                                                    º
    º  Enter the disk drive and directory where you would like to        º
    º  install the 4DOS utilities (HELP, FIXSTACK, etc.) and auxiliary   º
    º  files (sample aliases, README.DOC, etc.).                         º
    º                                                                    º
    º                                                                    º
    º                                                                    º
    º  4DOS can remain resident in memory (requires 55K), or can swap    º
    º  itself to expanded memory or to disk (requires < 5K).             º
    º                                                                    º
    º     Enter E (EMS), D (disk), or R (resident) :                     º
    º                                                                    º
    º  Are you using an 80286 or 80386-based computer (Y = yes)?         º
    º                                                                    º
    ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ¼
endtext
:get_boot
screen 8 10 ^ eset boot ^ screen 9 5
if isdir %boot goto boot_OK
md %boot >& nul ^ if isdir %boot goto boot_OK
beep ^ goto get_boot
:boot_OK
set utilities=%boot
:get_utilities
screen 14 10 ^ eset utilities ^ screen 15 5
if isdir %utilities goto get_swap
md %utilities >& nul ^ if isdir %utilities goto get_swap
beep ^ goto get_utilities
:get_swap
screen 19 53 ^ input %%swap ^ screen 20 5
if "%swap" == "E" set swap=/S:E ^ if "%swap" == "E" goto get_processor
if "%swap" == "D" set swap=/S:D ^ if "%swap" == "D" goto get_processor
if "%swap" == "R" set swap ^ if "%swap" == "R" goto get_processor
beep ^ goto get_swap
:get_processor
screen 21 65 ^ input %%at ^ screen 22 5
if not "%at" == "Y" set at=N
set load ^ if "%boot" == "C:\" goto get_config
if "%boot" == "A:\" goto get_config
set load=/L:%boot
cls ^ screen 2 0 ^ text
    ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
    º                                                                   º
    º  CAUTION:  You have chosen to install 4DOS in a directory which   º
    º  is not a normal boot drive / directory (A:\ or C:\).  If the     º
    º  name of the directory you have chosen is long it is possible     º
    º  that you will run into an MS-DOS / PC-DOS bug which will         º
    º  cause your system to boot improperly.                            º
    º                                                                   º
    º  While this will not be a problem on most systems, you should     º
    º  read the section of the README.DOC file entitled "Installation   º
    º  CAUTION!" to be sure that this bug will not cause you trouble.   º
    º  The README.DOC file will be displayed automatically at the end   º
    º  of this installation procedure.                                  º
    º                                                                   º
    º  Press any key when you are ready to continue...                  º
    º                                                                   º
    ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ¼
endtext
screen 16 55 ^ inkey %%var ^ cls
:get_config
set shell_installed=N ^ set ansi_installed=N ^ set keystack_installed=N
cls ^ cdd %boot ^ if not exist CONFIG.SYS goto copy_4DOS
screen 2 0 ^ text
    ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
    º                                                                   º
    º  There is already a CONFIG.SYS file in the boot directory you     º
    º  specified.  4DOS will now display the file so you can look at    º
    º  it.  You will then be asked whether certain commands appear in   º
    º  the file as listed.  If you answer Yes to one of these           º
    º  questions the corresponding command will not be added to the     º
    º  CONFIG.SYS file again.                                           º
    º                                                                   º
    º  If you already have a SHELL= command in CONFIG.SYS then you      º
    º  will have to edit it manually to set the proper shell name       º
    º  and swapping options.                                            º
    º                                                                   º
    º  You will be asked if the command "DEVICE=ANSI.SYS" appears       º
    º  in the list.  If you have any ANSI-compatible driver specified   º
    º  (including ANSI.SYS, NANSI, FANSI-Console, etc.) you can         º
    º  answer Yes to this question.  Otherwise answer No.               º
    º                                                                   º
    º  Press any key when you are ready to continue...                  º
    º                                                                   º
    ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ¼
endtext
screen 20 55 ^ inkey %%var
:chk_shell
cls ^ type CONFIG.SYS ^ echo.
input Does a line beginning "SHELL=" appear in the above display (Y = yes)? %%shell_installed
echo.
input Does the command "DEVICE=ANSI.SYS" appear in the above display (Y = yes)? %%ansi_installed
echo.
input Does the command "DEVICE=KEYSTACK.SYS" appear in the above display (Y = yes)? %%keystack_installed
:copy_4DOS
cls ^ screen 2 0 ^ text
    ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
    º                                                                   º
    º  4DOS will now copy its files to the boot drive and directory     º
    º  you specified.  The original CONFIG.SYS file (if any) in that    º
    º  directory will be saved to CONFIG.SAV, and CONFIG.SYS will       º
    º  be modified to include the new 4DOS commands.                    º
    º                                                                   º
    º  The 4DOS utility programs and auxiliary files will be copied     º
    º  to the drive and directory you specified for utilities.  If      º
    º  that directory is not included in your PATH statement (in        º
    º  AUTOEXEC.BAT), you may want to modify the path so that 4DOS      º
    º  can find the utility programs when you want to run them.         º
    º                                                                   º
    º  Press any key when you are ready to continue...                  º
    º                                                                   º
    ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ¼
endtext
screen 15 55 ^ inkey %%var ^ cls
cdd %boot ^ if exist config.sys copy config.sys config.sav
if not "%ansi_installed" == "Y" echo DEVICE=%cwds%ansi >>! config.sys
if not "%keystack_installed" == "Y" echo DEVICE=%cwds%keystack >>! config.sys
if not "%shell_installed" == "Y" echo SHELL=%cwds%prog %swap %load /p >>! config.sys
if "%share" == "Y" goto copy_share
set cname=4dos.com ^ gosub docopy
if "%at" == "Y" set cname=4dos286.exe
if "%at" == "N" set cname=4dos88.exe
gosub docopy
set cname=ansi.sys ^ gosub docopy
set cname=keystack.sys ^ gosub docopy
cdd %utilities
set cname=4d-pif.dvp ^ gosub docopy
set cname=aliases.bat ^ gosub docopy
set cname=arc-e.com ^ gosub docopy
set cname=arc-e.doc ^ gosub docopy
set cname=dos.hlp ^ gosub docopy
set cname=fixstack.doc ^ gosub docopy
set cname=fixstack.exe ^ gosub docopy
set cname=help.exe ^ gosub docopy
set cname=readme.doc ^ gosub docopy
set cname=tsrcom.arc ^ gosub docopy
goto readme
:copy_share
if not "%at" == "Y" goto get88
%d:\arc-e %d:\4dos 4dos286.exe
goto extract
:get88
set cname=4dos88.exe ^ gosub docopy
:extract
%d:\arc-e %d:\4dos 4dos.com ansi.sys keystack.sys 
cdd %utilities
set cname=4ddoc.arc ^ gosub docopy
set cname=arc-e.com ^ gosub docopy
set cname=tsrcom.arc ^ gosub docopy
%d:\arc-e %d:\4dos 4d-pif.dvp aliases.bat arc-e.* dos.hlp fixstack.*
%d:\arc-e %d:\4dos help.exe readme.doc register.frm 
:readme
pause Press any key when you are ready to continue...
cls ^ screen 2 0 ^ text
    ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
    º                                                                   º
    º  4DOS will now display the contents of the README.DOC file.       º
    º  This file contains important information about the version of    º
    º  4DOS on your disk.  Please read it carefully.  You may find it   º
    º  more convenient to print the README file.  Once you have         º
    º  finished looking at the file on the screen 4DOS will prompt      º
    º  you to see whether you want to print it, or later you can        º
    º  follow the simple print instructions at the start of the file.   º
    º                                                                   º
    º  Press any key when you are ready to continue...                  º
    º                                                                   º
    ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ¼
endtext
screen 12 55 ^ inkey %%var
list readme.doc
:chk_print
cls ^ screen 5 0 ^ text
    ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
    º                                                                   º
    º  Would you like to print the README.DOC file (Y = yes)?           º
    º                                                                   º
    ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ¼
endtext
screen 7 62 ^ input %%do_print ^ screen 8 5
if not "%do_print" == "Y" goto inst_done
cls ^ screen 2 0 ^ text
    ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
    º                                                                   º
    º  Be sure your printer is set up in normal mode and aligned at     º
    º  the top of a page.                                               º
    º                                                                   º
    º  Press any key when you are ready to continue...                  º
    º                                                                   º
    ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ¼
endtext
screen 7 55 ^ inkey %%var ^ screen 11 0
copy readme.doc prn
:inst_done
cls ^ screen 2 0 ^ text
    ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
    º                                                                   º
    º  4DOS installation is complete.  To start 4DOS as your system's   º
    º  command processor, you must re-boot the system.  If any errors   º
    º  occurred during file copying you should check your CONFIG.SYS    º
    º  file and be sure other files have been copied properly before    º
    º  rebooting the system.                                            º
    º                                                                   º
    º  If you installed 4DOS in a directory other than the root         º
    º  directory of your boot drive, you will have to manually          º
    º  merge the CONFIG.SYS file created during installation with       º
    º  your own CONFIG.SYS file, and you will also have to set the      º
    º  COMSPEC environment variable properly (see the COMSPEC section   º
    º  in the README.DOC file).                                         º
    º                                                                   º
    º  Press any key to return to DOS...                                º
    º                                                                   º
    ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ¼
endtext
screen 17 41 ^ inkey %%var ^ cls ^ cdd %startdir ^ quit
:done

