BE may be used to enhance batch files (.CMD). It has various sub commands available. Use BE to create interactive, more powerful batch files.
Usage: BE <File Spec> or BE command parametersWhere command is one of the following:
Enter BE command ? to get help on a specific command.
BE has two command formats. It can be passed all of its command line arguments at once, for example:
BE SA White on BlueOr BE can be passed a response file to parse. In this mode BE can be passed multiple commands all at once, and they will be executed in sequence. Be aware however, that some commands (SEMWAIT for example) will return an exit code. The response file will not be processed beyond any command which returns an exit code. Return codes are useful for a batch programmer to enable the control of the execution of a .CMD file.
A response file is a file which contains BE commands and parameters for batch processing. Each line in the file contains one BE command. Response files do not require BE to be on each individual line. For example:
BE TestFilewhere TestFile contains:
SA White on BlueAll of the following examples will be of the BE command parameters format.
BE ASK prompts the user for a response to a question. Use ASK to make conditional branches (jumps) in your .CMD files.
Usage: BE ASK "prompt" key-list <DEFAULT=key>TIMEOUT=n ADJUST=n Colour Spec
BE ASK prompts the user for a response to a question. ASK will return an error code to OS/2 so that the IF ERRORLEVEL batch command can be used to make conditional branches (jumps) in your .CMD files.
Note that both the "prompt" and [key-list] options must be supplied.
Rem this is the first sample batch file BE ASK "Start the network in Server mode [Y/n]?" YN Default=Y timeout=10 If errorlevel 2 goto Requester Rem Start the network in server mode Net Start Server Goto Quit :Requester BE ASK "Start the network in Requester mode [Y/n]?" YN Default=Y timeout=10 If errorlevel 2 goto Quit Net Start Requester :QuitThis batch file will ask the user if they wish to start IBM LAN Server in Server mode. If the user responds "No" to this, by pressing the "N" key, they will be further prompted to start LAN Server in Requester mode. If the user does not press any key within 10 seconds, the default option of Y is used to start the network in server mode.
REM this is the second sample batch file BE ASK "Press the Y key only" Y Echo You pressed the Y key :QuitThis example is as about as simple as you can get. It prompts the user to only press the 'Y' key.
BE BEEP plays a tune file.
Usage: BE BEEP <file>Options
The following options are valid in tune files:
They can also be specified in raw Frequency Duration pairs. This makes BEEP compatible with Maximus BBS format tune files.
The repeat and wait options only apply to the line on which they appear.
Tune files may also have comments in them. Comments start with a semicolon ";".
BE BEEP allows you to play tunes on your computer. It supports a wide variety of formats.
Two sample tune files have been provided. These are INDIANA and SIMPSONS.
BE BEEP INDIANAWill play the "Indiana Jones" theme.
BE BEEP SIMPSONSWill play the theme from "The Simpsons".
BOX allows you to display a box on your text screen.
Usage: BE BOX top left bottom right <colour spec> STYLE=nParameters
The row and column coordinates can range from one up to the maximum row and column coordinates as specified by the MODE command. These values have a default value which is dependent on your video adaptor.
BOX allows you to display a box on the screen. Only the boarder of the box is drawn. The body, or centre of the box is left as is. The type of box characters drawn can be specified by the STYLE parameter. A SA colour specification may also be added to set the colours of the drawn box.
BE BOX 1 1 25 80In standard VGA screen mode (80 columns by 25 rows), the above command will display a box which will outline the entire screen in the current screen colours.
BE BOX 10 10 15 70 Bright Green on BlackThis will display a box using bright green characters on a black background in the middle of the screen.
BE BOX 10 10 15 70 Bright Red on Black Style=1This will display a box using bright red characters on a black background in the middle of the screen. The box will be drawn using single line box characters.
Clears the current screen.
Usage: BE CLS
BE CLS will clear the current screen. This is identical to the OS/2 CLS command and is included so that it may be used in a response file.
BE CLSThis will clear the current screen. The current screen colour remains unchanged.
The BE DAY returns the current day of the month as an error level.
Usage: BE DAY
BE DAY will return the current day of the month as an error level so that batch programs can carry out actions on specified days. This BE sub command will return an error level to the OS/2 command interpreter. With the use of this command any processing of a BE response file will cease.
BE DAYThe current day of the month will be returned as an error level. The returned values are in the range of 1 to 31.
BE DELAY waits for a specified period.
Usage: BE DELAY ticks {-ESC} (1 tick = 1/18 second)Parameters
The BE DELAY command is useful to force a batch file to pause for a fixed period of time. You could use the BE DELAY command to allow some of your computers on a network to boot and establish themselves before they start to share each other's resources.
Net Start Server REM Wait for 5 minutes REM Wait for the other machine to boot and wait for us BE DELAY 5400 Logon Chris Net Use H: Main-HThis example starts LAN Server in server mode. BE then waits for 5 minutes for another server to boot and then logs on and uses the resources of other machines.
BE MONTH returns the current month of the year as an error level.
Usage: BE MONTH
BE MONTH will return the current month of the year as an error level to enable batch programs to carry out actions in a specified month. This BE sub command will return an error level to the OS/2 command interpreter. Any processing of a BE response file will cease with this command. The month of January will return an error level of 1 and so on.
BE MONTHThe current month of the year will be returned as an error level. The returned values are in the range of 1 to 12.
BE PRINTCHAR prints a specified character at the current cursor position a defined number of times.
Usage: BE PRINTCHAR character count <colour spec>Parameters
BE PRINTCHAR is a convenient way of displaying a single character multiple times. Using BE ROWCOL will establish the cursor position.
Note : If more than one character is given, then only the first one will be printed.
BE PRINTCHAR A 20 bright green on blueThis will print the letter "A" 20 times at the current cursor position. The "A" will be bright green on a blue background.
BE PRINTCHAR " " 10This example will print 10 spaces at the current cursor position.
BE REBOOT will shutdown all file systems and then reboot your computer.
Usage: BE REBOOT {-NOVERIFY}
BE REBOOT allows you to reboot your computer. It will shutdown all file systems, close all open files and then reboot.
Warning : USING THIS METHOD TO REBOOT YOUR COMPUTER IS DANGEROUS. THE CURRENTLY ACTIVE PROGRAMS RECEIVE NO WARNING THAT THE MACHINE IS ABOUT TO BE REBOOTED. DATA LOSS COULD RESULT BECAUSE A PROGRAM MAY HAVE DATA IN MEMORY WHICH HAS NOT BEEN SAVED TO DISK.
This option of BE requires the DOS compatibility box to be installed. If BE is unable to reboot the computer due to the DOS compatibility box not being installed you will be given the following error message:
DOS.SYS not installed (SYS0110).Microsoft Windows NT does not support this command. Using Windows NT you will see the above error.
BE REBOOTWith this example you will be asked if you wish to continue and reboot the computer, or cancel the command.
BE REBOOT /NOVERIFYThis example will not prompt the user, it will simply reboot the computer.
It is recommended that this command is only used when a user will not be in attendance. An example could be to force a machine to reboot at midnight.
BE ROWCOL will position the cursor at the specified location, and if required, print some text in a given colour.
Usage: BE ROWCOL row col <"text"> colour specParameters
BE ROWCOL positions the cursor at the specified row and column position. It may also optionally display some text. The colour of the displayed text may also be specified. This option is most useful in a BE response file.
The row and column coordinates start at 1 and range up to the maximum row and column coordinates as specified by the MODE command. These values have a default value dependent on your video adaptor.
BE ROWCOL 10 10Positions the cursor at 10, 10.
BE ROWCOL 15 40 HelloPrints "Hello" at 15, 40.
BE ROWCOL 16 40 "Hello There"Prints "Hello There" at 16,40.
BE ROWCOL 17 40 "Hello There Again" Bright RedPrints "Hello There Again" at 17, 40 in bright red on a black background.
BE SA allows the user to specify the current screen attributes, or colours.
Usage: BE SA [bright] [blinking] [reverse] [underline] <colour> on colour -cParameters
The valid colours are:
BE SA allows the user to specify the current screen attributes, or colours. It sets the current screen attributes so that any further displayed text will appear in those attributes unless overridden with a colour specification from another BE SA or similar command.
BE SA REDThis will set the current foreground colour to red. The background colour is set to black.
BE SA ON REDThis will set the current background colour to white on red. If the foreground colour is not specified it will default to white.
BE SA Bright greenThis will set the foreground colour to bright green on black.
BE SA REVERSE -cThis will set the current text colours to black text on a white background, after the screen has been cleared.
BE SA blue reverseThis will set the current text colours to blue on a white background.
BE SA blinking redThis will set the current foreground text colour to blinking red on a black background.
BE SEMCLEAR is used to clear a system semaphore.
Usage: BE SEMCLEAR <semaphore>Parameter
A system semaphore has two states; set or cleared. The BE SEMCLEAR command clears the specified semaphore. Please consult Appendix B - SEMMGR for a description of SEMMGR and semaphores.
BE SEMCLEAR testThis example clears the semaphore \SEM\SEMMGR\TEST. It must have been previously created using the BE SEMCREATE command.
BE SEMCLEAR test\testThis example clears the semaphore \SEM\SEMMGR\TEST\TEST.
BE SEMCLOSE closes a system semaphore.
Usage: BE SEMCLOSE <semaphore>Parameter
The BE SEMCLOSE command closes a semaphore which is managed by SEMMGR. The semaphore must be cleared before SEMCLOSE can be called. If it is not cleared, an error will occur. When the semaphore is closed, it is no longer maintained by SEMMGR. Thus it no longer exists. For the same semaphore to be reused again, it must be recreated with the BE SEMCREATE command. Please consult Appendix B - SEMMGR for a description of SEMMGR and semaphores.
BE SEMCLOSE testThis example closes the semaphore \SEM\SEMMGR\test.
BE SEMCLOSE test\testThis example closes the semaphore \SEM\SEMMGR\test\test.
BE SEMCREATE is used to create a system semaphore.
Usage: BE SEMCREATE <semaphore>Parameters
A semaphore must be created before it can be used. BE SEMCREATE does this. When a semaphore is created, its initial state is cleared. See Appendix B for a complete discussion on the use of semaphores.
SEMMGR has a maximum limit of 128 semaphores.
BE SEMCREATE testThis example will create a semaphore. The complete semaphore name is \SEM\SEMMGR\test. However you will only supply the name which follows \SEM\SEMMGR\. SEMMGR builds up the complete semaphore name for you.
BE SEMCREATE test\testThe semaphore \SEM\SEMMGR\TEST\TEST will be created for you. It may then be used in subsequent semaphore operations.
BE SEMKILL terminates the detached process SEMMGR.
Usage: BE SEMKILL
SEMMGR is a detached process. It runs in the background. It has no way of accepting commands from the user, except from BE. The BE SEMKILL command sends a command to SEMMGR to force SEMMGR to terminate.
Warning : When SEMMGR is terminated it clears all semaphores and closes them. This may cause unexpected results in your batch programs. Its use is not recommended, although sometimes it is necessary to unilaterally clear and close all SEMMGR managed semaphores. Please consult Appendix B - SEMMGR for a description of SEMMGR and semaphores.
BE SEMKILLThe BE SEMKILL command has no parameters. This is the only way in which it may be called.
BE SEMLIST lists all of the semaphores currently managed by SEMMGR and their state.
Usage: BE SEMLIST
The BE SEMLIST command lists the full name of each of the semaphores managed by SEMMGR as well as their state. Please consult Appendix B - SEMMGR for a description of SEMMGR and semaphores.
BE SEMLISTThere are no parameters for the BE SEMLIST command. The output of the command will look similar to:
State Semaphore Name: ----- -------------- Set \SEM\SEMMGR\test Clear \SEM\SEMMGR\test\test
BE SEMSET is used to clear a system semaphore.
Usage: BE SEMSET <semaphore>Parameter
A system semaphore has two states; set or cleared. The BE SEMSET command sets the specified semaphore. The BE SEMSET command waits for the semaphore to be cleared before it is again set. This is to stop semaphore contention problems. Please consult Appendix B - SEMMGR for a description of SEMMGR and semaphores.
BE SEMSET testThis example sets the semaphore \SEM\SEMMGR\TEST. It must have been previously created using the BE SEMCREATE command.
BE SEMSET test\testThis example sets the semaphore \SEM\SEMMGR\TEST\TEST.
BE SEMWAIT waits for a specified semaphore to clear.
Usage: BE SEMWAIT <semaphore> [timeout (in mSec)]Parameters
Semaphores have two states - they are either set or cleared. The default state of a semaphore when it is created is cleared. The BE SEMWAIT command waits for a semaphore's state to change from set to clear. A timeout period, (the period that you are prepared to wait for the semaphore to clear), may also be specified. The timeout period is specified in milliseconds. If a period is not given, BE will wait indefinitely. If the timeout period is given, and the semaphore has not cleared within that period, BE will return with an error level of 1. If the semaphore is already clear, or is cleared while BE is waiting for it, BE will return with an error level of 0. See Appendix B for a complete discussion on the use of SEMMGR and semaphores.
Unless it is the last command, this command should not be used in a response file. This BE sub command will return an error level to the OS/2 command interpreter. Any processing of a BE response file will cease with the use of this command.
BE SEMWAIT testThis example waits for the semaphore \SEM\SEMMGR\TEST to clear. BE will wait indefinitely for the semaphore to clear. It will return immediately if the semaphore is already clear. The error level returned is 0.
BE SEMWAIT test\test 10000This example waits for the semaphore \SEM\SEMMGR\TEST\TEST to clear. If the semaphore has not cleared within the specified time (10 seconds), an error level of 1 will be returned. Otherwise the semaphore has cleared and an error level of 0 will be returned.
BE WEEKDAY returns the current day of the week as an error level.
Usage: BE WEEKDAY
BE WEEKDAY will return the current day of the week as an error level to enable batch programs to carry out actions on a specified day. This BE sub command will return an error level to the OS/2 command interpreter. Any processing of a BE response file will cease with this command. Sunday will return an error level of 1, Monday an error level of 2 and so on.
BE WEEKDAYThe current day of the week will be returned as an error level. The returned values are in the range of 1 to 7.
BE WINDOW allows you to display a window on the text screen.
Usage: BE WINDOW top left bottom right <colour spec> [EXPLODE] [SHADOW] STYLE=nParameters
The row and column coordinates range from one up to the maximum row and column coordinates as specified by the MODE command. These values have a default value dependent on your video adaptor.
BE WINDOW allows you to display a window on the screen. Unlike the BE BOX command, window fills in the body of the window with spaces, BE BOX does not. The type of box characters drawn can be specified by the STYLE parameter. A SA colour specification may also be added to set the colours of the drawn box.
BE WINDOW 1 1 25 80In standard VGA screen mode (80 columns by 25 rows), the above command will display a window which will outline the entire screen in the current screen colours.
BE WINDOW 10 10 15 70 Bright Green on BlackThis will display a bright green window in the middle of the screen.
BE YEAR returns the current year as an error level.
Usage: BE YEAR
BE YEAR will return the current year as an error level to enable batch programs to carry out actions in a specified year. This BE sub command will return an error level to the OS/2 command interpreter. Any processing of a BE response file will cease with this command. The year 1995 will return an error level of 95 and so on.
BE YEARThe current year will be returned as an error level. The year 2000 will return a value of 100, the year 1994 an error level of 94 and so on.