|
-
April 8th, 2002, 09:53 PM
#1
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.
-
April 8th, 2002, 10:56 PM
#2
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 !
-
April 10th, 2002, 05:55 AM
#3
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).]
-
April 10th, 2002, 12:59 PM
#4
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 !
-
April 10th, 2002, 07:58 PM
#5
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.
-
April 15th, 2002, 11:26 PM
#6
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
-
Forum Rules
|
|