1-2-3 Notes All Versions October 30, 1984 Lotus Development Corporation The Autoexec Batch File NOTE 105 INTRODUCTION Batch files are an efficient way to store frequently used sequences of commands. The operating system (DOS) automatically executes the sequence of commands whenever you execute the batch file. All batch files are identified by a file name followed by the three letter extension .BAT. An autoexec batch file is a special type of batch file. Whenever you start or restart the computer and load the operating system, DOS checks the disk for a file named AUTOEXEC.BAT. When there is an AUTOEXEC.BAT file, DOS reads it first and follows its commands. The 1-2-3 System Disk comes with an AUTOEXEC.BAT file on it. The file contains instructions to prompt for the date and time and to load the 1-2-3 program into the computer's memory. You can modify 1-2-3's AUTOEXEC.BAT file to do other chores, such as automatically change subdirectories on the hard disk or display a message to the user. If there is a series of commands you use every time you start the computer, putting them into the AUTOEXEC.BAT file will save you time and keystrokes. This note explains how to change the AUTOEXEC.BAT file so that you enter the 1-2-3 worksheet without going through the Access System menu. LOOKING AT THE AUTOEXEC.BAT FILE You can examine the contents of the AUTOEXEC.BAT file by using DOS. If you are using 1-2-3, exit from the 1-2-3 program by selecting Quit and Yes from the 1-2-3 Program menu. When the Access System menu appears, select Exit and Yes to get into DOS. The DOS prompt should appear. If you have a two-diskette system, the prompt should be A>, which represents the disk drive on the left, drive A. If you have a hard disk system, the prompt may be another letter, such as C>, which represents the hard disk drive. For either system, if you do not have an A> prompt, type a: and press the Return key. You must have the A> prompt so DOS can read the AUTOEXEC.BAT file from the System Disk you will put in drive A. Note: This note uses A> to represent the floppy disk drive and C> to represent the hard disk drive. Some computer systems use different letters. Check your system to determine how the disk drives are defined, and substitute appropriate letters for your system in the following exercises. Once you have the A> prompt, put the 1-2-3 System Disk in drive A. Use DOS's Type command followed by the file name to display the contents of the AUTOEXEC.BAT file: Type: type autoexec.bat [RETURN] The screen will look like this: date time lotus The AUTOEXEC.BAT file supplied with 1-2-3 contains only three commands. The Date and Time commands are the DOS commands that tell the computer to prompt for the date and time. The Lotus command tells the computer to load the 1-2-3 files and display the 1-2-3 Access System menu. Note: To execute the AUTOEXEC.BAT file, the computer must be able to find all the files listed in it. If you have a two- diskette system, all the files listed in the AUTOEXEC.BAT file must be on the same disk as the AUTOEXEC.BAT file. If you have a hard disk system, the AUTOEXEC.BAT file and all of the 1-2-3 files can be located in the root directory, or the AUTOEXEC.BAT file can be in the root directory and the 1-2-3 files can be in a subdirectory. If your 1-2-3 files are in a subdirectory, there must be instructions in the AUTOEXEC.BAT file that tell the computer where to locate the 1-2-3 files. CHANGING THE AUTOEXEC.BAT FILE The following example changes the AUTOEXEC.BAT file so that you enter the 1-2-3 worksheet without going through the Access System menu. This brings a worksheet to the screen quickly when you start 1-2-3. Follow the directions appropriate to your system. Two-Diskette System 1. Put the 1-2-3 System Disk in drive A. Begin in DOS with the A> prompt on the screen. If you have another prompt, change to the A> prompt: Type: a:[RETURN] 2. Using DOS's Copy command, tell the system to copy a new AUTOEXEC.BAT file from the console (monitor): Type: copy con: autoexec.bat [RETURN] 3. The new AUTOEXEC.BAT file will still prompt you to enter the date and time but it will bypass the Access System menu and go directly to a worksheet: Type: date [RETURN] time [RETURN 123 [RETURN] 4. Mark the end of the file with Control Z, the ASCII end-of-file character. Hold down the Ctrl key and press the Z key. The following appears on the screen: ^Z 5. Press the Return key. The drive A light will come on, and in a few seconds, the following message will appear: 1 File(s) copied You have created a new AUTOEXEC.BAT file and copied it over the old one on the 1-2-3 System Disk. 6. To make sure you entered the commands correctly, use DOS's Type command to see the contents of the new file: Type: type autoexec.bat [RETURN] The file should look like this: date time 123 You will not see the ^Z because it is a hidden character. 7. Now warm boot (restart) the computer by pressing the appropriate keys. The drive A light will go on and the date and time prompts will appear. After you enter the date and time, the AUTOEXEC.BAT file will tell the computer to load the 1-2-3 program. Soon, the 1-2-3 copyright screen will appear. Press any key to get to a worksheet. Should you need to use the Access System menu after you have entered 1-2-3 using this new AUTOEXEC.BAT file, you must return to DOS and the A> prompt. Put the 1-2-3 System Disk in drive A and type lotus. The Access System menu will appear. If you want to go to the Access System menu rather than a 1-2-3 worksheet each time you boot the system, follow the above procedure substituting the word lotus for 123 in the file. Hard Disk System To begin each computer session with 1-2-3, the AUTOEXEC.BAT file must be in the root directory on the hard disk, and it must contain directions to find and load the 1-2-3 files. Although the 1-2-3 files can be in the root directory, putting them in a subdirectory makes more efficient use of the hard disk. Note: The root directory can contain only one AUTOEXEC.BAT file. If there is already an AUTOEXEC.BAT file in the root directory and you follow the directions in this example, you will create a new AUTOEXEC.BAT file that will write over the old one. 1. Begin in DOS with the C> prompt on the screen. If you have another prompt, change to the C> prompt (or the prompt that represents the hard disk): Type: c: [RETURN] 2. Using DOS's Change Directory command, go to the root directory: Type: chdir\ [RETURN] 3. Using DOS's Copy command, tell the system to copy a new AUTOEXEC.BAT file from the console (monitor): Type: copy con: autoexec.bat [RETURN] 4. If the 1-2-3 files are in a subdirectory, enter the commands that tell the system to prompt for the date and time, change into the subdirectory containing 1-2-3, and automatically load 1-2-3: Type: date [RETURN] time [RETURN] chdir c:\subdirectory name [RETURN] 123 [RETURN] If the 1-2-3 files are in the root directory rather than a subdirectory, type the following: Type: date [RETURN] time [RETURN] 123 [RETURN] 5. Mark the end of the file with Control Z, the ASCII end-of-file character. Hold down the Ctrl key and press the Z key. The following appears on the screen: ^Z 6. Press the Return key. The hard disk drive light will come on, and in a few seconds, the following message will appear on the screen: 1 File(s) copied You have created a new AUTOEXEC.BAT file and copied it into the root directory on the hard disk. 7. To make sure you entered the commands correctly, use DOS's Type command to see the contents of the new file: Type: type autoexec.bat [RETURN] If the 1-2-3 files are in a subdirectory, the AUTOEXEC.BAT file should look like this: date time chdir c:\subdirectory name 123 If the 1-2-3 files are in the root directory, the AUTOEXEC.BAT file should look like this: date time 123 You will not see the ^Z because it is a hidden character. 8. Open the drive A door. Now warm boot (restart) the computer by pressing the appropriate keys. The drive A and C lights will go on and the date prompt will appear. Make sure the 1-2-3 System Disk is in drive A. Close the drive A door and enter the date. At the time prompt, enter the time. The AUTOEXEC.BAT file will tell the computer to load the 1-2-3 program, and soon, the 1-2-3 copyright screen will appear. Press any key to get to a worksheet. Should you need to use the Access System menu after you have entered 1-2-3 using this new AUTOEXEC.BAT file, you must return to DOS and the C> prompt. Make sure the 1-2-3 System Disk is in drive A and then type lotus. The Access System menu will appear. If you want to go to the Access System menu rather than a 1-2-3 worksheet each time you boot the system, follow the above procedure substituting the word lotus for 123 in the file. DOS INFORMATION If you need more information about DOS, the root directory, or subdirectories, consult the DOS manual. Note: Release 1A of 1-2-3 does not support all of the DOS 2.0 and 2.1 commands. The Assign, Mode, and Path commands can produce unpredictable results when used with 1-2-3.