* HELP NEEDED DESPERATELY FOR AUTOEXEC.BAT *

* HELP NEEDED DESPERATELY FOR AUTOEXEC.BAT *

Post by Willem Nieuwenhu » Sat, 16 Sep 1995 04:00:00



Quote:> HELP!  I'm trying to have my AUTOEXEC.BAT act as a menu, by using the
> CHOICE, IF, and GOTO command.

> At choice part, I have:

> CHOICE /C:12 /N SYSTEM ENVIRONMENT:

> I want it to do so, that when I press "1", it will run MS-WINDOWS, and
> "2", it will run MS-DOS.

> I know it's something like this in the autoexec.bat file-----

> CHOICE /C:12 /N SYSTEM ENVIRONMENT:

> <IF STATEMENT NEEDED>   <==== need help here!

>  :ONE
>  win

>  :TWO
>  prompt $p$g
>  cls

Maybe you had better use the menu system already built in in
config.sys. You would have to do no programming yourself. To
implement the two choice menu:

  [Menu]
  Menuitem=Windows
  MenuItem=Dos
  Me*fault=Dos,5

  [Windows]
  ...

  [Dos]
  ...

  [Common]

This will display the short menu and defaults to the Dos selection,
which will be choosen if no key is pressed after 5 seconds. For every
menu selection there should be a section in config.sys, as shown above.
The [common] section is for devices that are common to all.

The selection you made will be available in autoexec.bat in the
environment variable "config". In autoexec.bat your code would be
something like:

  ...(common code)

  goto %config

  :Windows
  rem start windows
  win
  ...
  goto finish

  :dos
  rem don't start windows
  ...
  goto finish

  (possible other selections)

  :finish

If you want to know more, just read the dos manuals or the dos help
file, which explains everything mentioned above, (and possibly more).

HTH,

Willem Nieuwenhuis
Ilwis Department, ITC

 
 
 

1. HELP NEEDED DESPERATELY FOR AUTOEXEC.BAT

In referenced article, Batman says...

Did you try typing "help choice" at the DOS prompt?  No??  Why not??

What you want is:

    CHOICE /C:12 /N SYSTEM ENVIRONMENT:
    IF ERRORLEVEL 2 GOTO TWO

    :ONE
    win

    :TWO
    prompt $p$g
    cls

When testing ERRORLEVEL you must test the higher values first, because
"IF ERRORLEVEL X" actually means "IF ERRORLEVEL >= X"
---
Ray Dunn (opinions are my own) | Phone: (514) 938 9050
Montreal                       | Phax : (514) 938 5225

2. NFS3 over TCP?

3. Help needed for custom autoexec.bat file

4. DHCP Server object of Active Directory

5. autoexec.bat and understanding bat files

6. LPR from winos2?

7. Need Info on Autoexec.bat files

8. HyperTerm Settings and XP

9. Need to Modify AUTOEXEC.BAT

10. HELP: msd.exe hangs using my autoexec.bat and config.sys

11. Autoexec.bat, config.sys setup...HELP

12. Help with error trapping in autoexec.bat.

13. HELP AUTOEXEC.BAT PUZZEL