Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Dos Batch help please!  (Read 2684 times)

0 Members and 1 Guest are viewing this topic.

metalgear1419

  • Guest
Dos Batch help please!
« on: October 23, 2006, 07:34:32 AM »
Sorry if this was double posted...

I have an assignment in which I have to do the following and I am having quite a bit of trouble with it, would anyone be kind enough to do it for me I promise I will not forget that or any help would be greatly appreciated. The assignment is as follows

Design a batch file, called UTIL.BAT that contains these elements combined together:

Create a menu with no less than five options, each option going to a different section within the same batch file. The menu options and their respective actions are as follows.
•      1. One section asks the user “What is your name?” , stores the result, and prints it to the screen (use the Input utility)

•      2. One section asks the user “Give me the name and path of a file” (Use the INPUT utility. The filename may include an extension). The same section then prompts the user: “Enter an extension” and captures that.  It will check for a file with the same path and filename but with the separately input extension (use the JUSTNAME utility to strip the extension from the initial file). It will state whether the file exists or not (use the IF EXIST batch command).

•      3. This section prompts the user to input  the name of a directory .
Then use the FOR command and  pass the directory name and  each filename in this directory that ends in *.TXT to a subroutine (Batch File ) called DISPBAK.BAT .
DISPAK.BAT will do the following:
1.      Copy each file to the current directory
2.      Copy each file to a backup directory on the floppy drive called BACKUP with  the extension  changed to .BAK
3.      Display the contents of each file on the screen with its text in alphabetic order.
  
•      4. One section displays the main batch file (assume that you do not know the name util.bat ) in the EDIT window.

•      5. The last section tells the user, by his name, that the batch file has reached the end.

The user should be able to check each section before the batch file ends – create a loop that brings the user back to the main menu, before exiting.

Yout batch files must have remarks for each section  - clearly identifying that section and the purpose for that section. Note – The more remarks the better.

Make sure that you create a boot diskette with the following files are on the same diskette as the UTIL.BAT  and SEARCH.BAT batch files:
•      JUSTNAME.EXE
•      INPUT.EXE
•      CHOICE.COM
•      EDIT.COM
•      COMMAND.COM
All files should be stored in the root directory. (Or you can use other directories and the PATH command in you autoexec.bat).


I've included the Justname.exe,input.exe,choice.exe,edit.com,command.com all in the attached rar.

This is do tomorrow so any help would be greatly appreaciated thanks very much.

HCS

  • Guest
Re: Dos Batch help please!
« Reply #1 on: October 23, 2006, 08:24:00 AM »
Have you ever created a batch file? If not it Is pretty simple. Do you want me to give you the program (.bat)? or just the code? If you want I can just help you through creating it.

-Hale's Computer Service
Visit Us!
www.halescomputerservice.vze.com

2k_dummy



    Specialist
  • A word, once spoken, can never be recalled.
  • Thanked: 14
    Re: Dos Batch help please!
    « Reply #2 on: October 23, 2006, 09:19:52 AM »
    Homework is best left to the student. They won't learn if we do the work for them.
    If you don't stand for something, you'll fall for anything.
    _______________________________________ ________
    BlackViper

    Software and utilities

    metalgear1419

    • Guest
    Re: Dos Batch help please!
    « Reply #3 on: October 23, 2006, 11:39:23 AM »
    Quote
    Have you ever created a batch file? If not it Is pretty simple. Do you want me to give you the program (.bat)? or just the code? If you want I can just help you through creating it.

    -Hale's Computer Service
    Visit Us!
    www.halescomputerservice.vze.com

    If you don't mind could u please help me with it I have never created a batch file till now.

    Thanks!

    metalgear1419

    • Guest
    Re: Dos Batch help please!
    « Reply #4 on: October 23, 2006, 12:47:20 PM »
    I don't really have time to go through it today so if u don't mind the code or the bat will do please... btw I do have it partially done but i don't feel very confident in my code but heres what i got so far anyways.

    PATH=C:\DOS;A:/input.exe;%PATH%
    @echo off
    REM Menu
    CLS
    :start
    echo .
    echo File Menu
    echo ==============
    echo.
    echo 1 Enter Your Name.
    A:
    input.exe
    INPUT name "What is your name:
    echo %name%
    choice Your choice: /c:2345
    echo 2 Enter the name and path of a file.    
    A:
    input.exe
    input file "Give me the name and path of a file."


    input extension
    input extension "Enter an extension"  

    A:
    justname.exe
    justname extension input.exe
    echo %extension%

    echo 3 Input a directory of your choice.
    echo 4 Display main batch file.
    echo 5 Exit Program

    IF ERRORLEVEL 1 GOTO END
    beep


    Thanks very much.
    « Last Edit: October 23, 2006, 12:51:47 PM by metalgear1419 »

    QBasicMac

    • Guest
    Re: Dos Batch help please!
    « Reply #5 on: October 23, 2006, 02:33:23 PM »
    This might be a start. I did #4 for you.

    Mac

    Code: [Select]
    @echo off
    :MainHere
    @echo.
    @pause
    cls
    echo Menu:
    echo 1 Enter Your Name
    echo 2 Get name and path of a file
    echo 3 Get directory name
    echo 4 Edit this BAT file
    echo 5 Terminate Bat File
    echo.
    choice /c12345 /n "Choice: "
    if errorlevel 5 goto L5
    if errorlevel 4 goto L4
    if errorlevel 3 goto L3
    if errorlevel 2 goto L2
    if errorlevel 1 goto L1
    :L0
    echo L0
    goto MainHere
    :L1
    echo L1
    goto MainHere
    :L2
    echo L2
    goto MainHere
    :L3
    echo L3
    goto MainHere
    :L4
    notepad %0.bat
    goto MainHere
    :L5
    echo L5

    GuruGary



      Adviser
      Re: Dos Batch help please!
      « Reply #6 on: October 23, 2006, 04:16:26 PM »
      Quote
      ... but heres what i got so far anyways.

      PATH=C:\DOS;A:/input.exe;%PATH%

      Your path statement should not contain a front slash, and should not contain a file.  It is OK to point to the path / directory where a file resides.  So it should look like this:
      Code: [Select]
      set PATH=C:\DOS;A:\;%PATH%It is also probably not a good idea to include the drive letter of a removable drive in the path ... but I left that part in there.

      Also ... what version of DOS are you working in?
      « Last Edit: October 23, 2006, 04:17:16 PM by GuruGary »

      HCS

      • Guest
      Re: Dos Batch help please!
      « Reply #7 on: October 23, 2006, 06:01:51 PM »
      Well, if you dont get the report in by the due date. if you still are interested in learning batch Computer Hope has a pretty impressive tutorial...
      http://www.computerhope.com/batch.htm

      -Hale's Computer Service

      GX1_Man

      • Guest
      Re: Dos Batch help please!
      « Reply #8 on: October 24, 2006, 04:03:07 AM »