Unloading the Netware Shell There are times when it is necessary to free up the memory used by the NetWare workstation shell, whether it is to run a memory intensive application, such a Aldus' Pagemaker, or to load other network communications software, such as Digital Equipment Corp's DECNET DOS. Additionally, it would be nice to easily restore the workstation's path specifications, DOS COMSPEC (tells DOS where to find COMMAND.COM), etc., to the state they were in before logging in to the network. To accomplish these tasks most of us resort to the infamous keys. With the help of a couple of utilities, there is now a better way. SETCWD, from Cyco Software of the Netherlands, will set the environment variables CWD and DRV to the current working directory and current working drive. By using %DRV% and %CWD% in a batch file, you can return to that drive and directory. LASTDRIV, from Software Suprizes, determines the last valid drive available to a PC. If used after loading the NetWare shell and before logging in, LASTDRIV will locate the SYS:LOGIN directory on a file server. MARKNET and RELNET, part of TSR Utilities Version 2.8 from TurboPower Software, are specifically designed to release network communications software. (TSR stands for Terminate-and-stay- resident or RAM-Resident software.) The programs were written primarily to release the NetWare shell but seems to work with other LAN software as well, such as DECNET DOS. MARKNET writes a disk file in which it stores information about the system's status, then leaves a mark in memory 144 to 192 bytes in size. RELNET will release any RAM-resident software loaded after this mark. By using these utilities in batch files you can create a logout routine that will unload the NetWare shell files and restore your DOS environment to the state it was in before loading the shell. Here is one way to set this up: o Copy SETCWD.EXE, LASTDRIV.EXE, MARKNET.EXE and RELNET.EXE to the root directory of you boot disk (or the directory that contains your network boot files, including the SHELL.CFG file, if any). o If your boot files are in the root directory of your boot disk, add the command SETCWD to your AUTOEXEC.BAT file before any drive or directory change commands. SETCWD will set the variable DRV equal to the current drive letter (e.g., "C:"), and set the variable CWD to your current directory (if this is the root directory, then it would be "\"). Example: SETCWD PROMPT=$P$G PATH C:\;C:\UTIL;C:\DOS If your boot files are not in the root directory, use CHDIR (CD) in your AUTOEXEC.BAT file to go to the directory containing your boot files. SETCWD should be the very next command in the AUTOEXEC.BAT file. Example: PROMPT=$P$G PATH C:\;C:\UTIL;C:\DOS CD\NETBOOT SETCWD o If you want to load the shell and log in to a file server from your AUTOEXEC.BAT file add the following lines to the end of the file (after you have changed to the boot file directory and run SETCWD): MARKNET %DRV%\SHELL.MRK IPX NET3 LASTDRIV LOGIN^Z * This will: o create the status file in the boot file directory of your boot disk) o load the shell o locate the SYS:LOGIN directory on the file server o run the LOGIN program. If you do not want to load the shell and log in to a file server from your AUTOEXEC.BAT file, then create a separate batch file (such as NET.BAT) with the following lines: %DRV% CD%CWD% MARKNET %DRV%\SHELL.MRK IPX NET3 LASTDRIV LOGIN^Z * This batch file will: o change to your boot disk o change to your network boot file directory o create the status file in the boot file directory of your boot disk) o load the shell o locate the SYS:LOGIN directory on the file server o run the LOGIN program. o Rename the LOGOUT.EXE program in SYS:PUBLIC LOGOFF.EXE. You will have to flag the program read/write before you change the name, then re-flag it read only. o Create the following batch file in the SYS:PUBLIC directory on your file server, name it LOGOUT.BAT, and flag it SRO (shareable read only): ECHO OFF IF NOT '%1'=='' GOTO END %DRV% CD %CWD% IF EXIST %DRV%\CLEARNET.BAT CLEARNET :END LOGOFF %1^Z * This file checks to see if you have entered a file server name as a parameter to the LOGOUT command. If you have entered a server name, you are only logged out of that file server, and the workstation shell is unaffected. If you have not entered a server name, and there is a CLEARNET.BAT file in the boot file directory of your workstation, control is passed to CLEARNET.BAT, which logs you out of all servers, removes the shell and all TSRs loaded after the shell and then resets the DOS environment. If there is no CLEARNET.BAT file, you are logged out in the normal manner. o Create the following batch file in the root directory of your boot disk and name it CLEARNET.BAT: LOGOFF RELNET %DRV%\SHELL.MRK^Z * This batch runs the re-named LOGOFF (formerly LOGOUT) to log you out of all file servers, then runs RELNET, which resets the DOS environment based on the information previously placed in the SHELL.MRK file by MARKNET. If you log out from a station that has MARKNET and RELNET set up properly, your shell will be unloaded and your environment reset. If the workstation is not setup, you will just have a normal logout. MAPMEM, which is part of TSR Utilities, will display memory usage in your PC. This can be used to make sure that the proper programs are removed from memory. The DOS SET command will tell you if the environment has been properly reset. * A Note on Batch File End-Of-File Markers: In these batch file examples the end-of-file marker (^Z) is placed at the end of the last line, rather than on the following line. DOS looks for another command to execute each time it encounters a carriage return in a batch file. This is what causes the double prompt displayed after the execution of batch files. By placing the end- of-file marker on the same line as the last command, the double prompt is eliminated, and DOS does not look to the boot drive to execute another command after running the NetWare login script. Patrick H. Corrigan The Corrigan Group - Information Services San Francisco, California Telephone: 415/296-9219 Fax: 415/296-9421 CServ: 75170,146 June, 1989 This file is from the companion disk to Building Local Area Networks With Novell's NetWare, by Patrick H. Corrigan and Aisling Guy. It was uploaded by Patrick Corrigan.