Hands On
[Geek Home] [PC Hints & Tips] [Internet] [Programming] [Nanet Sites]

Now let’s put it into practice. I will give you an assignment. You do it. Simple enough?

Okay, let’s go:

1. If you are in Windows, drop to DOS

2. Backup your config.sys and autoexec.bat files

3. Create a startup disk

4. Reboot your computer, skipping your startup files Now reboot again normally.

5. Run PC Maintenance

6. Set up multiple configuration startup files. I’ll walk you through this one:

Make sure you have backups of your config.sys and autoexec.bat files because we are totally going to change them and you’ll want to restore them.

Edit your config.sys file and remove everything and type in this: (you DO have it backed up don’t you????)

[MENU]
menuitem=Test1
menuitem=Test2
menuitem=Both
menudefault=Test1,10

[Test1]
[Test2]
[Both]

[COMMON]
SHELL=C:\COMMAND.COM C:\ /P /E:32768

Now edit your autoexec.bat file and remove everything and type in this: (you DO have it backed up don’t you????)

PROMPT=$P$G

IF %CONFIG% == Both GOTO Test1
GOTO %CONFIG%

:Test1
echo this is a test.
pause
IF %CONFIG% == Both GOTO Test2
GOTO END

:Test2
echo this is a test2
pause
GOTO END

:END
echo this is the end
pause

  • Reboot your computer. You’ll notice depending on which one you select, you will get a phrase echoed back to the screen.
  • “echo this is a test.”
    Will put the phrase “this is a test” on your screen when you run it. “pause” will pause and ask you to hit a key to continue. It kind of allows you to step through and see what’s happening. (To step through your config.sys and autoexec.bat files, you can also reboot, holding down the “F8” key and select to step through the files.
    See the instructions for details.)
  • Notice how: IF %CONFIG% == Both GOTO Test1 takes you to Test1 instead of :Both. There is no :Both tag because we don’t want to repeat Test1 and Test2 stuff just to run them both. Instead we check the %CONFIG% flag and go to the first one, then after the first tag we check again so that we can go to the second one.
  • Reboot three times, selecting the three options. After the third, you should understand what is going on.
  • Now recover your original autoexec.bat and config.sys. You did make backups didn’t you?
Picture
 Hands On
[Geek Home] [PC Hints & Tips] [Internet] [Programming] [Nanet Sites]

Modified: 02/11/99

Picture