| United States-English |
|
|
|
![]() |
HP 9000 Networking: Supervising the Network > Chapter 5 Customizing the User EnvironmentLogin Script Commands and Variables |
|
This section describes the commands you can use in a login script. The commands are presented in alphabetical order. Syntax conventions for login script commands, as shown in Table 5-3, are the same as those for workstation text utilities, with one exception: some login script commands must be preceded by the # symbol. Following is an example of the syntax for the MAP login script command:
The command syntax is described in Table 5-3. Table 5-3 Command Syntax Conventions
Use the # symbol to execute a program that is external to the login script.
Replace path with a drive letter; or, if you have specified NOSWAP on the command line or in the login script, you may replace path with a full directory path beginning with the NetWare volume name. Replace filename with an executable file (files that end in .EXE, .COM, or .BAT, for example). Do not include the extension. Replace parameter with any parameters that must accompany the executable file. If you want the LOGIN utility to execute a program that is external to the login script, enter the # command (symbol) followed by the name of the file you want to execute. This command fails when
When you want to define a default print queue and printer, you can make the login script execute the NetWare CAPTURE utility. This allows you to send print jobs to a network print queue (named QUEUE_FOR_LASERJET in this example). If you have a search drive mapped to SYS:PUBLIC where the NetWare utilities are stored, you could enter the following command in the login script:
You do not need to enter a path in this case because CAPTURE is located in a search drive. If you do not have a search drive mapped to a directory, include the path to that directory in the command. For example, to run a batch file named BATCH.BAT in the ACCOUNTS directory, use the following command: #Z:\ACCOUNTS\BATCH Use ATTACH to connect to a NetWare 2 or NetWare 3 server or to a NetWare 4 server using bindery services while the login script is running. Replace server with the name of the NetWare server to which you want to attach. Replace username with the login name. If you do not include the username, the user is prompted for a login name when the ATTACH command is executed from the login script. You can replace password with the correct password for that user and server. If the username and password are the same as the primary login username and password, you can omit the password and not be prompted for it. Use caution when including passwords in a login script, however. It is more secure to eliminate the password. Then, at the point in the login script where the ATTACH command is executed, the user is prompted for the password. Use BREAK ON to allow the user to terminate execution of the login script. The default is BREAK OFF. If BREAK ON is included in a login script, you can press <Ctrl>+<C> or <Ctrl>+<Break> to abort the normal execution of your login script. Including BREAK ON in a login script does not affect the DOS <Ctrl>+<Break> check. For more details, see "DOS BREAK" in this chapter. When the BREAK option is ON, type-ahead keyboard input is not saved in the buffer. Use COMSPEC in the login script to execute DOS commands from the network. Specify the directory where DOS and the DOS command processor (COMMAND.COM) are loaded. COMSPEC is originally set when DOS is booted. It must be reset after you log in to change the location that COMMAND.COM loads from while you are logged in to the network.
Replace path with either a drive letter or a full directory path beginning with the NetWare volume name. Follow these guidelines for using COMSPEC:
Use CONTEXT to set a user's current context in the Directory tree. Replace context with the context you want the user to see after login. As with the workstation CX utility, you can enter a complete name to move down through the context, or you can use periods to move up toward the Root of the Directory tree.
To change the context to the Organizational Unit SALES, under the Organization ACME_US, add the following line to the login script:
You can type a single period instead of a container name to indicate that you want to move up one level. For example, if you are in the context SALES.ACME_US and you want to move up one level to the context ACME_US, add the following line to the login script.
To move up two levels, enter two periods, and so on. Use DISPLAY to show the contents of a text file on a workstation's screen when the user logs in. This command works best with an ASCII file. If you use DISPLAY with a word-processing file, printer and word-processing codes are displayed with the text.
Replace path with either a drive letter or a full directory path beginning with the NetWare volume name. Replace filename with the complete name (including the extension) of the file you want to display. When you use DISPLAY to display the contents of a file on the screen, the exact characters in the file, including any printer and word-processing codes, appear on the workstation screen. (To display only the text and suppress codes, use FDISPLAY. See "Using FDISPLAY" in this chapter.) If the given directory does not exist or the file is not found, no error message appears on the screen when the user logs in. Suppose you put messages in a file called SYSNEWS.TXT, in the directory SYS:PUBLIC\MESSAGES, and you want your users to see this file on their screens when they log in on Mondays. Add the following lines to the container login script:
Use DOS BREAK to set the <Ctrl>+<Break> checking level for DOS. If DOS BREAK is set to ON, you can terminate a program (other than the login script) by pressing <Ctrl>+<Break>.
Enter the following command in the login script:
The default is DOS BREAK OFF. Use DOS VERIFY to verify that data written to a local drive is not written to a bad sector and can be read without an error. The DOS COPY and NCOPY commands do not automatically verify that data copied to a local drive can be read after the copy. To assure verification of each copy operation after login, add the VERIFY ON and DOS VERIFY ON commands (for network and DOS copies respectively) to the login script. Another option, since VERIFY ON can affect performance by slowing down write operations, is to use the /V option at the command line with each COPY or NCOPY operation. The default in the login script is DOS VERIFY OFF. These commands may not work with some software that is copy-protected. Use DRIVE to change the default drive while the login script is executing.
Replace drive with a local or network drive letter, or replace n with a drive number. Which one you use depends on what is being assigned within the login script. Unless this command is in your login script, the default drive is set to the first network drive, which is often assigned to your home directory when you log in. If you don't want the default drive to be the first network drive, map a drive in the login script to the directory you want to be the default; then use the DRIVE command to change the default drive. Instead of specifying a drive letter, such as F: or G:, you can use an asterisk followed by a number n to represent the nth network drive (for example, *3). This allows drive letters to reorder themselves automatically if previous drive mappings are deleted or added. Suppose you expect to work on only one project for several days and the files for that project are located on drive S:. You can use the DRIVE command to set your default drive to S: so you won't have to change your default drive manually every time you log in. First, make sure you have mapped drive S: to the correct directory in your login script. Then enter the following command in the login script:
Use EXIT to terminate execution of the login script and execute an external program. The length of information between quotation marks cannot exceed your keyboard buffer length minus 1 (commonly 15 - 1 = 14 characters). You can use the EXIT command in a login script to stop the login script and execute a program, such as a word-processing or menu program. Because EXIT stops the login script, make sure you put this command at the end of the login script. You can also use EXIT in an IF...THEN statement so that the login script stops and exits to an external program only if a certain condition exists. If the condition doesn't exist, the login script skips the EXIT command and continues executing. If the program you are executing with the EXIT command requires any DOS paths or NetWare search drives to be set, make sure they are specified in the login script ahead of the EXIT command. Adding EXIT to a container login script prevents other profile or user login scripts from running. Putting EXIT in a profile login script prevents the user login script from running. The EXIT command works only on IBM*-compatible workstations running DOS. Therefore, if your DOS workstation has a machine name different from IBM_PC specified in its NET.CFG file, you must add the PCCOMPATIBLE login script command to the login script. For more information about the PCCOMPATIBLE command, see "PCCOMPATIBLE" in this chapter.
Additional Information
Use FDISPLAY to show the text of a word-processing file on a workstation's screen when the user logs in. To display both the text and the printer and word-processing codes of a file, or to display an ASCII file, see "DISPLAY" in this chapter.
Replace path with either a drive letter or a full directory path beginning with the NetWare volume name. Replace filename with the complete name (including the extension) of the file you want to display. When you use FDISPLAY to display the contents of a word-processing file on the screen, the text in the file is filtered and formatted so that only the text itself is displayed. FDISPLAY does not display tabs. If the given directory does not exist or if the file is not found, no error message appears on the screen when the user logs in. Suppose you put messages in a file called SYSNEWS.TXT, in the directory SYS:PUBLIC\MESSAGES, and you want your users to see this file on their screens when they log in on Mondays. Add the following lines to the container login script:
Use FIRE PHASERS to signal the workstation to emit a phaser sound. Use this command alone to generate the phaser sound whenever a user logs in. Use FIRE PHASERS with the IF...THEN command to make the sound execute a different number of times depending on the circumstances of the login. The following line executes the phaser sound four times upon login:
To use an environment variable as the number of times to fire, use % before the variable, as follows:
Either of the following lines fires the phaser five times on Thursdays:
or
The identifier variable %NDAY_OF_WEEK indicates a number that corresponds to the day of the week. Since Thursday is the fifth day of the week, phasers fire five times on Thursdays. For more information about using identifier variables, see "Identifier Variables" on in this chapter. Use GOTO to execute a portion of the login script out of the regular sequence. Set BREAK ON in your login script before experimenting with GOTO loops so that you can break out of a login script if necessary. For more information about the BREAK login script command, see "BREAK" in this chapter. Do not use GOTO to enter or exit a nested IF...THEN statement. This usage confuses the program. To execute a loop of commands, you could include the following lines in your login script. In this case, the commands to be executed are labeled AGAIN (as indicated in the second line).
The GOTO command looks at the value of <X> (a DOS environment variable). If the value of <X> is less than 9, then <X> increments by 1 and GOTO loops back to the AGAIN label. When <X> gains the value of 9, the IF...THEN test becomes false, the GOTO is ignored, and the script continues normally. See the IF...THEN command next. Use ... IF...THEN when you want the login script to perform an action only under certain conditions.
......Replace conditional with identifier variables. For more information about identifier variables, see "Identifier Variables" in this chapter. Replace commands with any login script commands that you want to be executed if the specified condition is true. Follow these guidelines for using IF...THEN:
Six relationships are possible between the elements of an IF...THEN statement. Represent these relationships with the following symbols:
Additional Information
Use INCLUDE to execute independent files or another object's login script as a part of the login script currently being processed. These subscripts can be text files that contain valid login script commands (any of the commands explained in this section) or login scripts that belong to a different object you have rights to.
or
To use a text file as a subscript, replace path with either a drive letter or a full directory path beginning with the NetWare volume name. Replace filename with the complete name (including the extension) of the text file. To execute another object's login script as part of a login script, replace object_name with the name of the object whose login script you want to use. Text files that contain login script commands and other object's login scripts can be used as subscripts. Use these subscripts to supplement the main login script. You can create and edit text file subscripts using any text editor. Subscripts do not have to have any particular filenames or extensions. The INCLUDE command executes the login script commands contained in the subscript. It does not display the text of the subscripts. INCLUDE nesting is limited only by available memory. This means that one subscript file can include another subscript file, which can include yet another subscript file, and so on. If the subscript is a text file, users must have at least File Scan and Read rights to the directory containing the subscript. If you are using another object's login script as a subscript, users must have the Browse right to the object whose script you are including and the Read right to the object's Login Script property.
Use MACHINE to set the DOS machine name (such as IBM or EDIT_ROOM) of the workstation. The MACHINE command is necessary for some programs (such as NETBIOS) written to run under PC DOS. Do not confuse the MACHINE command with the identifier of the same name. The identifier is used with a preceding percent (%) sign in MAP and WRITE statements. The identifier reads its value from the NET.CFG file. It is unlikely that you will need to use this command. However, it is provided in case you come upon a program that requires it. The machine name can be up to 15 characters. (Longer machine names are truncated to 15 characters.) For example, to specify that the machine name is IBM_PS2, add the following line to the login script:
Additional Information
Use MAP to map drives and search drives to network directories.
Replace drive with any valid network drive letter, local drive letter, or search drive number. Replace path with a drive letter, a full directory path, or a Directory Map object. More than one command can be on the map line if the commands are separated by a semicolon (;), as shown in the following example:
When mapping a drive to a directory on an NDS server, begin the path with either the Volume object name or server/volume. When mapping to a directory on a bindery-based server or to an NDS server that isn't your current server, begin the path with the server's name. Replace option with one of the following:
Follow these guidelines when using MAP:
For DOS and Windows workstations, you can map search drives to directories that contain applications, executable files, and so forth. Then users can execute those applications regardless of the directory in which they are currently working. A maximum of 16 NetWare search drives is allowed.
When you map a search drive, use a search drive number (an S followed by a number). This search drive number assigns the next available drive letter to the mapping, starting with Z and working backwards through the English alphabet. The letter assigned to the search drive is put into the DOS path statement. If you already have search drives in the path statement, the command MAP S1:= will overwrite the first one in the path. To prevent search drive assignments from overriding existing DOS PATH letters, use the INSERT option when assigning search drives. For example, type
To ensure that users can access NetWare utilities, DOS directories, and applications, we recommend you map search drives to these directories in the following order:
To avoid inadvertently changing the order of any search drives that must be mapped to a specific drive letter, you can map all remaining search drives with the number S16:, which assigns the next lowest search number each time it is used. This command assigns the next available drive letter to the search drive without displacing the previous search drives. If you have an application that requires a particular drive letter, you can use the following command to map the search drive, replacing drive with the drive letter:
If you map a search drive using a number already assigned to a search drive, NetWare makes the old search drive a network drive. The letter assigned to the old search drive remains assigned as the converted drive mapping. The new search drive takes the next unused letter of the alphabet. Another way to map a drive to a directory is to create a Directory Map object that points to the directory. Then, if you move the directory, you only need to change the Directory Map object rather than all of the login scripts that may include that mapping.
For example, to map a search drive to a Directory Map object whose complete name is APPL.SALES_LA.ACME_US, add the following line to the login script:
In the previous example, the Directory Map object's name begins with a period, which indicates that the drive is mapped to the drive Root. If the user whose login script this line appears in is also located in the SALES_LA.ACME_US context, the MAP command does not have to specify the Directory Map object's complete name. Instead, the line would be
For more information about using Directory Map objects, see "Loading Operating Systems and Applications onto the Network" in chapter 3.
Additional Information
Use NO_DEFAULT in a container or profile login script if you do not want the default user login script to run. If you do not want to create any user login scripts, and you do not want the default user login script to run, add this command to either the container or the profile login script. If you have created a user login script for someone, that login script executes whether or not the NO_DEFAULT command is in the container or profile login script. Use NOSWAP to prevent the LOGIN utility from being moved out of conventional memory into higher memory (if available) or onto the disk to execute a # command and LOGIN at the same time. LOGIN always swaps to extended or expanded memory unless NOSWAP is specified on the command line or in the login script. If you do not want LOGIN to be temporarily stored in higher memory or on the workstation's disk, use the NOSWAP command. NOSWAP prevents LOGIN from being swapped out of conventional memory. Then, if the workstation does not have enough memory to handle both LOGIN and the # command, the # command fails but the rest of the login script executes as usual. If you want LOGIN to be swapped out of conventional memory immediately every time a # command is executed, place the SWAP command in the login script before the # command. Use PAUSE to create a pause in the execution of the login script. Enter this command in your login script at any point you want a pause to occur. You can add PAUSE to the login script following a message so that the user has time to read the message before it scrolls off the screen. If you include PAUSE, the message "Strike any key when ready..." appears on the workstation screen. The LOGIN utility then waits for a key to be pressed before it executes the rest of the login script. Use PCCOMPATIBLE to enable the EXIT "command" login script command to work if your workstation's LONG MACHINE NAME is not IBM_PC. If your computer is an IBM PC compatible machine and not an IBM PC, use PCCOMPATIBLE in your login script to inform the LOGIN utility that your machine's long name is something other than IBM_PC. The LONG MACHINE NAME (AT&T, COMPAQ, or others) must be included in the NET.CFG file. Place the following anywhere before EXIT in the login script:
If you have a Hewlett Packard computer and you have changed the LONG MACHINE NAME to HE_PAC in the NET.CFG file, and you want to exit to NETADMIN from within your login script, put the following commands in your login script:
Use PROFILE in a container script to set or override a user's assigned or command-line-specified profile script. It is useful when defining a group profile. Use REMARK to insert explanatory text into your login script. This text does not display on the screen.
or
or
Replace text with the comment you want to include in the login script. Follow these guidelines for using REMARK:
Use SCRIPT_SERVER to set a home server from where the bindery login script is read.
Use SET to set a DOS environment variable to a specified value.
Replace name with an environment parameter that identifies the environment you want to change. Replace value with identifier variable substitutions. Values must be enclosed in quotation marks. To change the environment for the login script, but not for the workstation after the login script has finished executing, use the optional keyword TEMP. Use the SET login script command the same way you use the DOS command SET. However, when you use SET in a login script, you must enter quotation marks (" ") around values.
The SET commands do not have to be included in login scripts. For example, you may decide that it is easier to put some SET commands in the workstation's AUTOEXEC.BAT file. Where you use SET commands depends upon your individual needs.
See the SHELL command in your DOS manual for more information about the environment size. After you use the SET command to set a value for an environment variable, you can use that variable in other login script commands. To include an environment variable as an identifier variable in a command, enclose the name of the variable in angle brackets, for example, <emailuser>.
Use SET_TIME to set the workstation time equal to the time on the NetWare server to which the workstation first connects. Use SHIFT to change the order in which %n identifier variables are interpreted in the login script. The SHIFT command allows users to enter LOGIN parameters in any order.
Replace n with the number of places you want the variable to shift. The default is SHIFT 1. You can shift up to 10 arguments. When users execute LOGIN, they can include additional parameters. Each of these parameters is assigned a %n variable; in this way, the parameter's real value can be substituted for the %n variable that appears in the login script. In the login script, you can add SHIFT with a positive or negative number to move the variables in either direction. For example, SHIFT -3 moves each %n variable three positions to the left. When Mary logs in, she wants to access her word-processing program, change the way it is set up, and map a drive to her work directory called ACCNTS. Mary also has a command in her login script to map a drive to her LOTUS directory, but she does not need it today. The commands in Mary's login script are shown here.
(In the last line, "IF "%2" < >" is followed by closed quotation marks, which means "If %2 isn't blank".) With these commands in her login script, Mary can log in to the primary file server (named FS1) using her username, MARY, as follows:
The parameters in Mary's LOGIN command are given the following values: %0=FS1 %1=MARY %2=WP %3=ACCNTS Mary's login script looks for %2, which is WP, and sets the word-processing environment. Then the login script shifts the variables one to the right so that %2 now becomes ACCNTS. Upon executing the loop, the login script maps a drive to the ACCNTS directory. Mary could also change the order of her LOGIN command without affecting the way her work environment is set up, as follows:
The parameters in this LOGIN command are given the following values: %0=FS1 %1=MARY %2=ACCNTS %3=WP In this case, Mary's login script looks for %2, which is now ACCNTS. The login script maps a drive to the ACCNTS directory. Then the login script shifts the variables to the right so that %2 now becomes WP. Upon executing the loop, the login script sets the word-processing environment. Use SWAP to move the LOGIN utility out of conventional memory into higher memory (if available) or onto the disk. This allows execution of a # command and LOGIN at the same time.
You can replace path with either a drive letter or a full directory path beginning with the NetWare volume name. By default, the LOGIN utility always swaps to extended or expanded memory, unless NOSWAP is specified on the command line or in the login script.
If you specify a path in the SWAP command, LOGIN swaps into the directory you specified. If the directory specified in that path does not exist or if you do not have rights there, LOGIN prompts you for another path. If you do not specify a path, LOGIN swaps either into higher memory (if available) or to the current drive. If LOGIN tries to swap to the current drive and you don't have rights to the current drive, LOGIN prompts you for a path to use. If you specify a valid path, LOGIN always swaps to the specified path. Then, if the workstation does not have enough memory to handle both LOGIN and the # command, the # command fails but the rest of the login script executes as usual. Use TEMP SET to change the environment for the login script, but not for the workstation after the login script has finished executing. See "SET" in this chapter. Use WRITE to display messages on the workstation screen when a user logs in.
Replace text with the words you want to display on the screen. Replace identifier with a variable you want to display, such as a user's login name. (See "Using Identifier Variables" in this chapter for a complete list of variables.) Text you want to display must be enclosed in quotation marks (" "). There are several ways to display variables in the text message. The way you enter the variable in the WRITE command determines the display format, as follows:
To join several text strings and identifier variables into a single display without enclosing the variables in quotation marks, use a semicolon between the text and the variables. If you have several WRITE commands, each one appears on a separate line on your workstation. However, if you put a semicolon at the end of all but the last WRITE command, the commands appear as one continuous sentence or paragraph (although they may wrap onto additional lines on the workstation's screen). Text strings can include the special characters in Table 5-4: Table 5-4 Text String Characters
In addition to the semicolon, there are other operators you can use to form compound strings (in other words, to join text and identifier variables into one command). These operators are listed in Table 5-5 in order of precedence. Table 5-5 Text and Identifier String Operators
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||