Online Book Reader

Home Category

CompTIA A_ Certification All-In-One Exam Guide, Seventh Edition - Michael Meyers [252]

By Root 1317 0
of this chapter.

Working with Files

This section deals with basic file manipulation. You will learn how to look at, copy, move, rename, and delete files. You’ll look at the ins and outs of batch files. The examples in this section are based on a C: root directory with the following files and directories:

C:\>dir

Volume in drive C has no label.

Volume Serial Number is 4C62-1572

Directory of C:\

05/26/2009 11:37 PM 0 AILog.txt

05/29/2009 05:33 PM 5,776 aoedoppl.txt

05/29/2009 05:33 PM 2,238 aoeWVlog.txt

07/12/2009 10:38 AM

books

07/15/2009 02:45 PM 1,708 CtDrvStp.log

07/12/2008 04:46 AM

Documents and Settings

06/04/2009 10:22 PM

Impressions Games

09/11/2008 11:32 AM

NVIDIA

08/06/2009 02:28 PM Other Drive

01/03/2009 01:12 PM

pers-drv

09/14/2008 11:11 AM

Program Files

09/12/2009 08:32 PM 21 statusclient.log

07/31/2009 10:40 PM 153 systemscandata.txt

03/13/2009 09:54 AM 1,111,040 t3h0

04/21/2009 04:19 PM

temp

01/10/2008 07:07 PM

WebCam

12/31/2007 10:18 AM

WINDOWS

09/14/2008 12:48 PM

WINNT

01/03/2008 09:06 AM

WUTemp

7 File(s) 1,120,936 bytes

12 Dir(s) 94,630,002,688 bytes free

Because you probably don’t have a PC with these files and directories, follow the examples but use what’s on your drive. In other words, create your own folders and copy files to them from various folders currently on your system.

Attributes


Remember way back in Chapter 4, “Understanding Windows,” when you had to make changes to the folder options in My Computer to see NTLDR, NTDETECT.COM, and other files? You were actually seeing files with special attributes.

All files have four special values, or attributes, that determine how programs (such as My Computer in Windows XP or Computer in Windows Vista) treat the file in special situations. The first attribute is the hidden attribute. If a file is hidden, it is not displayed when you issue the DIR command. Next is the read-only attribute. A file with a read-only attribute cannot be modified or deleted. Third is the system attribute, which is used only for system files such as NTLDR and BOOT.INI. In reality, it does nothing more than provide an easy identifier for these files. Fourth is the archive attribute, which is used by backup software to identify files that have been changed since their last backup.

ATTRIB.EXE is an external command-line program you can use to inspect and change file attributes. To inspect a file’s attributes, type the ATTRIB command followed by the name of the file. To see the attributes of the file AILog.txt, type ATTRIB AILOG.TXT. The result is

A AILog.txt

The letter A stands for archive, the only attribute of AILog.txt.

Go to the C:\ directory and type ATTRIB by itself. You’ll see a result similar to the following:

C:\>attrib

A C:\AILog.txt

A C:\aoedoppl.txt

A C:\aoeWVlog.txt

A H C:\AUTOEXEC.BAT

A SH C:\boot.ini

A H C:\CONFIG.SYS

A C:\CtDrvStp.log

A SH C:\hiberfil.sys

A SHR C:\IO.SYS

A SHR C:\MSDOS.SYS

A SHR C:\NTDETECT.COM

A SHR C:\ntldr

A SH C:\pagefile.sys

A C:\statusclient.log

A C:\systemscandata.txt

A C:\t3h0

The letter R means read-only, H is hidden, and S is system. Hey! There are some new files there. That’s right, some were hidden. Don’t panic if you see a number of files different from those just listed. No two C:\ directories are ever the same. In most cases, you’ll see many more files than just these. Notice that important files such as NTLDR and NTDETECT.COM have the system, hidden, and read-only attributes set. Microsoft does this to protect them from accidental deletion.

You also use the ATTRIB command to change a file’s attributes. To add an attribute to a file, type the attribute letter preceded by a plus sign (+) as an option, and then type the filename. To delete an attribute, use a minus sign (–). For example, to add the read-only attribute to the file AILOG.TXT, type this:

ATTRIB +R AILOG.TXT

To remove the archive attribute, type this:

ATTRIB -A AILOG.TXT

You can add or remove multiple attributes in one command. Here’s an example of removing three attributes from the NTDETECT.COM

Return Main Page Previous Page Next Page

®Online Book Reader