Batch File Assignment
Results 1 to 6 of 6

Thread: Batch File Assignment

  1. #1
    Join Date
    Aug 2001
    Posts
    104

    Batch File Assignment

    I am appealing to the pre-Win95 experts out there. I am just starting to get a sense of batch file commands but still get frustrated when it comes to writing the line. Choice, Errorlevel, and IF seem to be most confusing.
    Here is the assignment for class:

    Write a batch file called MENU.BAT which welcomes the user to ELT 210, displays the current date and time, displays a simple menu to the screen, and requests the user to make a choice. The on-screen menu is to consist of the following options.

    1.) Run the MS-DOS EDITOR with a optional filename.
    2.) FORMAT a diskette in drive A:
    3.) Run SCANDISK on an optional drive (A: is the default
    4.) Display system MEMORY
    5.) Run Microsoft Diagnostics
    6.) Exit this Menu (Return to MS-DOS)

    * After a choice is made, the user is to be returned to the menu - unless he or she chooses option 6.

    * After testing and debugging your batch file for proper operation, save it to a bootable floopy.

    I would appreaciate any help given.
    Thanks All.

  2. #2
    Join Date
    Jan 2000
    Location
    Pittsburgh, PA USA
    Posts
    2,053
    Hello tatunka....
    Fun with batch files!!!

    Check out this website.
    Click on the commmand names, like 'Choice' and 'If'.

    You will get a good explanation...

    http://home.att.net/~gobruen/progs/d....html#comm_ind

    Have fun batching !
    Dave

    ------------------
    *** Help others less fortunate.
    *** Help others less fortunate.

    JESUS IS LORD !

  3. #3
    Join Date
    Feb 2000
    Location
    26.03°N 80.14°W
    Posts
    9,410
    Hate to say it but, recommend steering clear of that site. Way too many errors. For example,

    Source: http://home.att.net/~gobruen/progs/d...ntro.html#path
    PATH
    ...
    If you are at the A: prompt and want to run a command on C: you must type FIND C:\myfile to use the FIND command, or if you are in C: you would need to type A:\FIND C:\myfile.
    • Typing the command:

         find c:\myfile

      (from any prompt) will return the error:

         FIND: Parameter format not correct
    • If you have FIND.EXE in the root directory of drive A: and type:

         a:\find c:\myfile

      (from any prompt), FIND will return the error:

         FIND: Parameter format not correct
    Source: http://home.att.net/~gobruen/progs/d...ntro.html#find
    FIND

    This is a very usefull tool for searching files for strings(text). If you have lost a file or renamed a file and cannot remember what the name was, you can use FIND to locate it. For example if your name is Joe and the missing file has your name in it, enter FIND "Joe" at the prompt. DOS will search the current directory for any file containing the string "Joe."
    • If FIND.EXE is in your PATH and you type:

         find "Joe"

      the cursor will jump down to the beginning of the next line on your screen and sit there blinking forever. (Press [Ctrl-C] or [Ctrl-Break] to abort).
    When you're typing out a FIND command, you have to think something along these lines: Look for (i.e., FIND), "this string of characters" (which must be enclosed within double-quotes), inside of some_filename.ext. Shorter version:

       find "some_string" somefilename.ext

    The MS-DOS version of this "syntax" can be seen by typing:

       find/?

    or:

       find  /?
    Code:
    Searches for a text string in a file or files.
    
    FIND [/V] [/C] [/N] [/I] "string" [[drive:][path]filename[ ...]]
    
      /V        Displays all lines NOT containing the specified string.
      /C        Displays only the count of lines containing the string.
      /N        Displays line numbers with the displayed lines.
      /I        Ignores the case of characters when searching for the string.
      "string"  Specifies the text string to find.
      [drive:][path]filename
                Specifies a file or files to search.
    
    If a pathname is not specified, FIND searches the text typed at the prompt
    or piped from another command.
    For even more info, type:

       help find

    or see the same info on the web here:    MS-DOS v6.22 Help: FIND (Click the <Index> link at the top-right of that page to see the complete listing of links to all of the MS-DOS 6.22 commands).

    Source: http://home.att.net/~gobruen/progs/d...tro.html#label
    LABEL

    Use for labeling a disk or changing the present label of a disk. To see what the current label is use VOL

     LABEL A:MY_FAVORITE_DISK
    [list=1][*]If you type:

       label a:my_favorite_disk

    LABEL will return the error:

       Too many characters in volume label

    A Volume Label can only contain up to 11 characters. Type:

       help label

    or click here for more info.[/list=a]Source: http://home.att.net/~gobruen/progs/d...ntro.html#copy
    COPY

    Copies files.

     COPY C:\myfile.txt A:\myfile.txt
    • If the source and destination filenames are to be the same, it is not necessary to specify the destination filename. In other words:

         copy c:\myfile.txt a:\

      will do exactly the same thing. (More here).
    Source: http://home.att.net/~gobruen/progs/d...ro.html#prompt
    PROMPT
    ...
    For example, PROMPT $aHello Jerk makes the prompt: Hello Jerk
    • The a$ will work but, it is not a valid parameter nor is it even necessary. Simply:

         prompt Hello Jerk

      will return the same results. (More here).
    Source: http://home.att.net/~gobruen/progs/d...dos_other.html
    MEM

    MEM will tell you how much memory(Random Operating Memory) you have and how much is being used.
    • ROM is Read Only Memory and RAM is Random Access Memory. The MEM command displays the amount of used and free RAM. (More here).
    Source: http://home.att.net/~gobruen/progs/d...dos_other.html
    FDISK
    ...
    After you use FDISK, the drive should be formated (sic) or "SYSed".
    • All partitions must be formatted. To make a partition bootable, you can either use FORMAT's "/s" parameter or use the SYS command later.


    There are many more but, I'm out of time (and patience).

    [This message has been edited by Vernon Frazee (edited 04-10-2002).]
    Vernon Frazee, Microsoft MVP (Windows - Shell/User)

    Defenses Up!
    Tip: When prompted for a password, give an incorrect one first. A phishing site will accept it; a legitimate one won't.


    Inside Spyware: A Guide to Finding, Removing and Preventing Online Pests


    If you don't keep up with security fixes, your computer|network won't be yours for long.

  4. #4
    Join Date
    Jan 2000
    Location
    Pittsburgh, PA USA
    Posts
    2,053
    Thanks Vern,
    I guess I didn't read it too closely.

    Boy you sure went all out on your post!!!!
    You have way too much time on your hands

    I just gleened through what you put up, and the 'fdisk' one stuck out for me!!!

    I figure, since tatunka didn't get anyone to do his homework for him, he moved on.

    Dave

    ------------------
    *** Help others less fortunate.
    *** Help others less fortunate.

    JESUS IS LORD !

  5. #5
    Join Date
    Aug 2001
    Posts
    104
    Dave,
    No, I don't expect you or anyone else to do my homework. The reason I asked for help is that Batch File programming is a lost art, and any books out there are out of print (pre 1995). The material I do have just defines the commands and there purpose and is not clear for someone just getting into batch files.

    I would like to thank you for your insight and concern and Vern for his web site update.

  6. #6
    Nix's Avatar
    Nix is offline Aka: Nix*, NNiixx, Nix23
    Join Date
    May 2001
    Location
    Sydney, Australia
    Posts
    8,255
    http://vernon.frazee.net/ms-dos/6.22/help/
    http://www.comp-air.com/vfrazee/batch/
    http://home7.inet.tele.dk/batfiles/main/showcase.htm
    http://gatsby.tafe.tas.edu.au/batch/html/commands.html

    ------------------
    File it under X for X-perience.

    [This message has been edited by Nix (edited 04-15-2002).]

    [This message has been edited by Nix (edited 04-15-2002).]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •