@echo off
if "%2"=="" goto help
for %%a in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if "%%a:"=="%1:" goto nocolon1
for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if "%%a:"=="%1:" goto nocolon1
for %%a in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if "%%a:"=="%1" goto colon1
for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if "%%a:"=="%1" goto colon1
goto helpbad1


:nocolon1
set _CLIENT=%1:
goto check2


:colon1
set _CLIENT=%1
goto check2


:check2
for %%a in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if "%%a:"=="%2:" goto nocolon2
for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if "%%a:"=="%2:" goto nocolon2
for %%a in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do if "%%a:"=="%2" goto colon2
for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if "%%a:"=="%2" goto colon2
goto helpbad2


:nocolon2
set _4XDRIVE=%2:
goto cont


:colon2
set _4XDRIVE=%2
goto cont


:cont
md %_CLIENT%\NWADMIN
if errorlevel==1 goto mkdirerr
goto cont2


:mkdirerr
echo.
echo ERROR: cannot create directory %_CLIENT%\NWADMIN.  This may be caused
echo        because there is already a directory by that name; there may be
echo        a file by that name; the drive may be read-only; or the drive
echo        may have no free space.  Please correct this condition and then
echo        try running NWSETUP.BAT again.
goto done


:cont2
if not exist %_4XDRIVE%\PUBLIC\NWADMIN.EXE goto badserv
goto cont3


:badserv
echo.
echo ERROR: drive %_4XDRIVE% does not have a \PUBLIC subdirectory.  This means that
echo        either you mapped this drive to a different volume than SYS: on the
echo        NetWare 4.x server, or you specified the wrong drive.  Please correct
echo        this condition and try running NWSETUP.BAT again.
goto done


:cont3
@echo on
@cls
@echo 57 files left...
copy %_4XDRIVE%\PUBLIC\NWADMIN.EXE              %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWADMIN.EXE
@if errorlevel==1 goto badfile
@cls
@echo 56 files left...
copy %_4XDRIVE%\PUBLIC\NWADMIN.INI              %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWADMIN.INI
@if errorlevel==1 goto badfile
@cls
@echo 55 files left...
copy %_4XDRIVE%\PUBLIC\NWC0COR.DLL              %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWC0COR.DLL
@if errorlevel==1 goto badfile
@cls
@echo 54 files left...
copy %_4XDRIVE%\PUBLIC\TCLASS31.DLL             %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\TCLASS31.DLL
@if errorlevel==1 goto badfile
@cls
@echo 53 files left...
copy %_4XDRIVE%\PUBLIC\OWL31.DLL                %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\OWL31.DLL
@if errorlevel==1 goto badfile
@cls
@echo 52 files left...
copy %_4XDRIVE%\PUBLIC\BC30RTL.DLL              %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\BC30RTL.DLL
@if errorlevel==1 goto badfile
@cls
@echo 51 files left...
copy %_4XDRIVE%\PUBLIC\NWBRWS.DLL               %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWBRWS.DLL
@if errorlevel==1 goto badfile
@cls
@echo 50 files left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\HCSSRES.DLL  %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\HCSSRES.DLL
@if errorlevel==1 goto badfile
@cls
@echo 49 files left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\NWADMINR.DLL %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\NWADMINR.DLL
@if errorlevel==1 goto badfile
@cls
@echo 48 files left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\NWPARR.DLL   %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\NWPARR.DLL
@if errorlevel==1 goto badfile
@cls
@echo 47 files left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\NWTOOLS.DLL  %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\NWTOOLS.DLL
@if errorlevel==1 goto badfile
@cls
@echo 46 files left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\PBTRVRES.DLL %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\PBTRVRES.DLL
@if errorlevel==1 goto badfile
@cls
@echo 45 files left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\WBROLLRS.DLL %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\WBROLLRS.DLL
@if errorlevel==1 goto badfile
@cls
@echo 44 files left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\WBTRVRES.DLL %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\WBTRVRES.DLL
@if errorlevel==1 goto badfile
@cls
@echo 43 files left...
copy %_4XDRIVE%\PUBLIC\NWC0DS.DLL               %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWC0DS.DLL
@if errorlevel==1 goto badfile
@cls
@echo 42 files left...
copy %_4XDRIVE%\PUBLIC\NWCNTRLS.DLL             %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWCNTRLS.DLL
@if errorlevel==1 goto badfile
@cls
@echo 41 files left...
copy %_4XDRIVE%\PUBLIC\NWRCON.DLL               %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWRCON.DLL
@if errorlevel==1 goto badfile
@cls
@echo 40 files left...
copy %_4XDRIVE%\PUBLIC\NWMOD00.DLL              %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWMOD00.DLL
@if errorlevel==1 goto badfile
@cls
@echo 39 files left...
copy %_4XDRIVE%\PUBLIC\NWMOD01.DLL              %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWMOD01.DLL
@if errorlevel==1 goto badfile
@cls
@echo 38 files left...
copy %_4XDRIVE%\PUBLIC\NWVCTRLS.DLL             %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWVCTRLS.DLL
@if errorlevel==1 goto badfile
@cls
@echo 37 files left...
copy %_4XDRIVE%\PUBLIC\NWVIS00.DLL              %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWVIS00.DLL
@if errorlevel==1 goto badfile
@cls
@echo 36 files left...
copy %_4XDRIVE%\PUBLIC\NWVIS01.DLL              %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWVIS01.DLL
@if errorlevel==1 goto badfile
@cls
@echo 35 files left...
copy %_4XDRIVE%\PUBLIC\NWVIS02.DLL              %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWVIS02.DLL
@if errorlevel==1 goto badfile
@cls
@echo 34 files left...
copy %_4XDRIVE%\PUBLIC\NWVPS.DLL                %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWVPS.DLL
@if errorlevel==1 goto badfile
@cls
@echo 33 files left...
copy %_4XDRIVE%\PUBLIC\NSAPI.DLL                %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NSAPI.DLL
@if errorlevel==1 goto badfile
@cls
@echo 32 files left...
copy %_4XDRIVE%\PUBLIC\NWVPT.DLL                %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWVPT.DLL
@if errorlevel==1 goto badfile
@cls
@echo 31 files left...
copy %_4XDRIVE%\PUBLIC\NWVQUEUE.DLL             %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NWVQUEUE.DLL
@if errorlevel==1 goto badfile
@cls
@echo 30 files left...
copy %_4XDRIVE%\PUBLIC\MUSCROLL.DLL             %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\MUSCROLL.DLL
@if errorlevel==1 goto badfile
@cls
@echo 29 files left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\NWADMIN.HLP  %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\NWADMIN.HLP
@if errorlevel==1 goto badfile
@cls
@echo 28 files left...
copy %_4XDRIVE%\PUBLIC\RCONSOLE.EXE             %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\RCONSOLE.EXE
@if errorlevel==1 goto badfile
@cls
@echo 27 files left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\RCONSOLE.HEP %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\RCONSOLE.HEP
@if errorlevel==1 goto badfile
@cls
@echo 26 files left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\RCONSOLE.MSG %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\RCONSOLE.MSG
@if errorlevel==1 goto badfile
@cls
@echo 25 files left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\NETADMIN.HEP %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\NETADMIN.HEP
@if errorlevel==1 goto badfile
@cls
@echo 24 files left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\NETADMIN.MSG %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\NETADMIN.MSG
@if errorlevel==1 goto badfile
@cls
@echo 23 files left...
copy %_4XDRIVE%\PUBLIC\NETADMIN.EXE             %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NETADMIN.EXE
@if errorlevel==1 goto badfile
@cls
@echo 22 files left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\TEXTUTIL.HEP %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\TEXTUTIL.HEP
@if errorlevel==1 goto badfile
@cls
@echo 21 files left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\TEXTUTIL.MSG %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\TEXTUTIL.MSG
@if errorlevel==1 goto badfile
@cls
@echo 20 files left...
copy %_4XDRIVE%\PUBLIC\CMPQ_AIO.OVL             %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\CMPQ_AIO.OVL
@if errorlevel==1 goto badfile
@cls
@echo 19 files left...
copy %_4XDRIVE%\PUBLIC\CMPQ_RUN.OVL             %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\CMPQ_RUN.OVL
@if errorlevel==1 goto badfile
@cls
@echo 18 files left...
copy %_4XDRIVE%\PUBLIC\DOSV_RUN.OVL             %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\DOSV_RUN.OVL
@if errorlevel==1 goto badfile
@cls
@echo 17 files left...
copy %_4XDRIVE%\PUBLIC\IBM_AIO.OVL              %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\IBM_AIO.OVL
@if errorlevel==1 goto badfile
@cls
@echo 16 files left...
copy %_4XDRIVE%\PUBLIC\IBM_RUN.OVL              %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\IBM_RUN.OVL
@if errorlevel==1 goto badfile
@cls
@echo 15 files left...
copy %_4XDRIVE%\PUBLIC\_AIO.OVL                 %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\_AIO.OVL
@if errorlevel==1 goto badfile
@cls
@echo 14 files left...
copy %_4XDRIVE%\PUBLIC\_RUN.OVL                 %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\_RUN.OVL
@if errorlevel==1 goto badfile
@cls
@echo 13 files left...
copy %_4XDRIVE%\PUBLIC\MENU.OVL                 %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\MENU.OVL
@if errorlevel==1 goto badfile
@cls
@echo 12 files left...
copy %_4XDRIVE%\PUBLIC\IBM$ISW.OVL              %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\IBM$ISW.OVL
@if errorlevel==1 goto badfile
@cls
@echo 11 files left...
copy %_4XDRIVE%\PUBLIC\TEXTUTIL.IDX             %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\TEXTUTIL.IDX
@if errorlevel==1 goto badfile
@cls
@echo 10 files left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\NWDSBRWS.MSG %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\NWDSBRWS.MSG
@if errorlevel==1 goto badfile
@cls
@echo  9 files left...
copy %_4XDRIVE%\PUBLIC\NLS\1252_UNI.001         %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\1252_UNI.001
@if errorlevel==1 goto badfile
@cls
@echo  8 files left...
copy %_4XDRIVE%\PUBLIC\NLS\437_UNI.001          %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\437_UNI.001
@if errorlevel==1 goto badfile
@cls
@echo  7 files left...
copy %_4XDRIVE%\PUBLIC\NLS\UNI_1252.001         %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\UNI_1252.001
@if errorlevel==1 goto badfile
@cls
@echo  6 files left...
copy %_4XDRIVE%\PUBLIC\NLS\850_UNI.001          %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\850_UNI.001
@if errorlevel==1 goto badfile
@cls
@echo  5 files left...
copy %_4XDRIVE%\PUBLIC\NLS\UNI_437.001          %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\UNI_437.001
@if errorlevel==1 goto badfile
@cls
@echo  4 files left...
copy %_4XDRIVE%\PUBLIC\NLS\UNI_850.001          %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\UNI_850.001
@if errorlevel==1 goto badfile
@cls
@echo  3 files left...
copy %_4XDRIVE%\PUBLIC\NLS\UNI_COL.001          %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\UNI_COL.001
@if errorlevel==1 goto badfile
@cls
@echo  2 files left...
copy %_4XDRIVE%\PUBLIC\NLS\UNI_MON.001          %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\UNI_MON.001
@if errorlevel==1 goto badfile
@cls
@echo  1 file left...
copy %_4XDRIVE%\PUBLIC\NLS\ENGLISH\SCHEMA.XLT   %_CLIENT%\NWADMIN
@if errorlevel==1 set _BADFILE=%_4XDRIVE%\PUBLIC\NLS\ENGLISH\SCHEMA.XLT
@if errorlevel==1 goto badfile
@echo off
echo.
echo NWSETUP is successful!  You must add %_CLIENT%\NWADMIN to your client's
echo PATH statement in your client's AUTOEXEC.BAT file, reboot the client, and
echo then you will be able to run NWADMIN and NETADMIN over your RAS connection.
goto done


:badfile
@echo off
echo.
echo ERROR: could not copy file: %_BADFILE% to %_CLIENT%\NWADMIN.
echo.
echo        You may have broken your connection; your %_CLIENT% drive may be full;
echo        the network (or NetWare server) may have gone down; or some other
echo        error may have occurred.  Please correct this condition, delete the
echo        %_CLIENT%\NWADMIN directory completely, and try running NWSETUP.BAT again.
goto done


:helpbad1
echo.
echo ERROR: invalid parameter, %1.
echo.
goto help
:helpbad2
echo.
echo ERROR: invalid parameter, %2.
echo.
:help
echo.
echo Usage: NWSETUP client_drive server_drive
echo.
echo where 'client_drive' is the client drive that the MetaFrame client is installed
echo and running from (for instance, 'C:'), and 'server_drive' is a the drive that
echo you previously mapped to the SYS: drive of your NetWare 4.x server.  (We will
echo copy files from the \PUBLIC subdirectory of 'server_drive's root.)
echo .
echo This batch file will copy the required NetWare 4.x files into a C:\NWADMIN
echo directory.  This enables users connected to the MetaFrame server through a RAS
echo connection to run the NetWare 4.x administrative tools, such as NWADMIN and
echo NETADMIN, from a local drive rather than having to pull the executables down
echo the wire each time they're being used.


:done
set _CLIENT=
set _4XDRIVE=
set _BADFILE=

