Informational Communication Technology

Laboratory work 4

Name: Taurkhanov Adil

Learning Exercise:

Perform the "DOS User Interface" lab on the CD that accompanies Parsons/Oja to practice using the DOS command-line interface. Do some additional exploring by trying the following:

Note: The help command is not available on all versions of DOS. If it is not available, you can view the help information for any command by including a slash-question mark switch /? ) on the command line after the command—like so, dir /?—and pressing ENTER.

Type the help command on the DOS command line to see a list of all DOS commands. Then type help rmdir to see the Help entry for a particular command.

The command color e9 changes the background and foreground text colors of the command window. Its argument is a hexadecimal number. Try it. Then try color 5b. For a list of colors, type help color. How can you set the color back to white-on-black?

Some commands, such as dir, have Help entries that do not fit on a single screen. Type help dir | more to view the Help entry one screen at a time.

The vertical bar ( | ) is pronounced "pipe." It is used to direct the output of one command (such as help) to the input of another (more, for example). The more command displays output one screen at a time; you must press the SPACEBAR to proceed to the next screen. However, with DOS systems, once you proceed to the next screen, there is no way to return to a preceding screen. (Modern applications with a GUI interface use a text window with a scroll bar to solve this problem.)

If you are in the middle of a listing and you want to stop it, you can type CTRL+C. Example: type help; you will see the first screen of the Help entry. Then hold down the CTRL key and press the C key. Doing so will halt the display of the Help entry and will return you to the DOS command prompt.

The assoc command (available in versions of Windows since Windows NT/2000 only) displays associations between file extensions and applications. Type assoc .doc and then assoc .txt. Be sure to include the period at the beginning of the extension.

The set command is used to set environment variables, which provide additional parameters to programs. Type set to see a list of the current variables and their values.



Certain commands accept a list of file names. Rather than typing in an actual list, it is often easier to use an asterisk ( * ) within a file name specification to get the command processor to generate a list of file names for us. An asterisk ( * ) acts as a wildcard character that can match any number of characters in a file name. Here are some examples of an asterisk used as a wildcard character with the dir command:

List only those files and folders in the root folder whose names start with "n":

dir c:\p* 

List only those files and folders in the root folder whose names end with "n":

dir c:\*s 

List only those files and folders in the root folder whose names contain an "n" anywhere:

dir c:\*a* 

List only those files in the root folder that are of type DOC:

dir c:\*.doc 

List all files and folders in the root folder.

dir c:\* 

In this last example the wildcard character can be omitted;
 dir c:\ works just as well.

If any command gives output to the console, you can redirect it into a text file. Here's how: Suppose we wanted to capture the output of the dir command to a filename called DirOutput.txt. All we need to do is add the “>” symbol (the greater-than sign here is the “redirector”) and then the filename to the end of the dir command like so: dir C:\> DirOutput.txt


File Compare

You can use this command to identify differences in text between two files. It’s particularly useful for writers and programmers trying to find small changes between two versions of a file. Simply type “fc” and then the directory path and file name of the two files you want to compare.


Question 1. DOS Commands

In this section, you will interface with the operating system using DOS commands.

For each of the following tasks, list the correct DOS command. Note:
The assignment is structured for each task to be completed in sequence; that is to say, a task may depend on the state created by previous tasks.

a. Display the syntax and switches for the command dir.

b. List all directories and files in C:\.

c. List all directories and files in C:\ with a file name beginning with W.

d. List all directories and files in C:\ with a file name containing A.

e. List all files in C:\ whose extension contains X and sort the results by size.

f. List all directories and files in C:\, redirecting the output to a file named "ICT.txt" in directory C:\.



g. List all directories and files in C:\, appending the output to ICT.txt.

h. In directory C:\, create a subdirectory called "ICT".

i. Copy ICT.txt to directory ICT.

a9. Rename ICT.txt in directory ICT as "ICT.bak".

aa. Delete ICT.txt.

ab. Remove directory ICT. 

ac. Create two output files and compare them.