Computing.Net > Forums > Disk Operating System > SOS! Need help with DOS Batch problem

SOS! Need help with DOS Batch problem

Reply to Message Icon

Original Message
Name: Donna
Date: September 22, 2001 at 06:59:42 Pacific
Subject: SOS! Need help with DOS Batch problem
Comment:

I am taking an online class in DOS, and, unfortunately, the last problem is way over my head. Here's what I have to do: Create a simple menu system to help someone with DOS commands. It is to be a main program and another program that is called to display directory listings. To start, I have to display this menu:
DOS COMMAND ACCESS MENU

1--Format a Diskette
2--List the files on a disk
3--Exit the menu

Enter the number of the function you want to perform:

The batch file needs to determine which option the user selected. If Option 3, the screen should be cleared and the batch file terminated. If Option 1 or 2, the batch file needs to prompt the user for additional information before actually issuing the command that will accomplish the desired function.

Option 1 - should format only the A:drive.
Check the syntax and parameters for the FORMAT command. The batch file needs to determine which combination of parameters to use based on user-supplied information. Batch file should allow the user to choose whether to have the system files copied as part of the formatting procedure or not. The user should be prompted by your batch file to indicate whether or not this is to be a quick format. Once the paramenters have been clarified, the batch file should execute the appropriate version of the FORMAT command.
OPTION 2 - Check the syntax and parameters for the DIR command. The batch file needs to determine which combination of parameters to use based on user-supplied information. The batch file should allow the user to choose a directory listing of either the A: or C: drive. The user should also be prompted by your batch file to indicate whether the listing is sorted by date or size. Once the parameters have been clarified, the batch file should send the proper parameters to your second batch program, which will then execute the appropriate version of the DIR command.

If the user has picked either of the first two options, the batch file should return to the menu screen after the requested task is finished to see what the user wants to do next. The main batch program file should be named DOSMENU.BAT. The directory listing program file should be named DIRLIST.BAT. The batch file should be adequately documented using remark statements.

What I have so far:
@echo off
echo DOS COMMANDS ACCESS MENU
echo.
echo 1--Format a Diskette
echo 2--List the files on a disk
echo 3--Exit the menu
echo.
echo Enter the number of the function you want to perform.
echo.
choice /c:123
if errorlevel 3 goto end
if errorlevel 2 goto dotwo
if errorlevel 1 goto dothree
:dotwo
echo 1--List the files for Drive A:
echo 2--List the files for Drive C:
echo.
echo Enter 1 for Drive A: or two for Drive C:
choice /c12
if errorlevel 2 goto doc
if errorlevel 1 goto doa
:doc

If anyone can help correct this and finish the rest, I would sure appreciate it. The only help I have is the /? and that is just not cutting it for me. Thank you!


Report Offensive Message For Removal


Response Number 1
Name: Larry
Date: September 22, 2001 at 11:02:59 Pacific
Subject: SOS! Need help with DOS Batch problem
Reply: (edit)

It doesn't look too functional yet... I think you've got format and dir commands with switches form previous posts?

1. put a label up top after your @echo off command called :START

2. to clear screens often as required, you need CLS commands after :start, :dotwo, :doone, :doc, :doa

3. you definately need an :END label at the bottom

4. You can put your prompt lines on your choice lines to save lines - check the /?

5. You'll need goto START lines to take you back to the top of the file when desired

(btw - school of hardknocks - labels can only be 8 characters long)


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: SOS!  Need help with DOS Batch problem

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge