7/12/2012 -- A few months ago, we took a look at the networking command line tools that the next release of the A+ exams from CompTIA includes in their objectives. The number of command line utilities beneath the operating system domain (1.3) is double that for networking; thus, we will look at the first half for this column and the second half the next time we visit the topic.
All of the tools are available in Windows XP, Vista and Windows 7, and the list includes: TASKKILL, BOOTREC, SHUTDOWN, TASKLIST, MD, RD, CD, DEL, FDISK and FORMAT. These OS command line tools are discussed in the sections that follow.
TASKKILL Command
The TASKKILL.EXE utility is used to terminate processes. Those processes can be identified by either name or process ID number (PID) and the process can exist on the machine where the administrator is sitting (the default) or on another machine -- in which case you signify the other system by using the /S switch.
The /IM name is used to specify an (image) name of a process to kill and can include the wildcard (*) characters. If the process ID number is used in place of the name, then the /PID switch is needed. The processes in question are the same which can be killed through the Task Manager. There are two signals that can be sent: The default is SIGTERM (a gentle kill, related to code 15) and the /F switch issues a SIGKILL (a terminate at all cost kill, related to code 9).
BOOTREC
The BOOTREC.EXE utility can be run in Windows 7 or Windows Vista to interact with the Master Boot Record (MBR), boot sector, or Boot Configuration Data (BCD) store. It cannot be used with Windows XP since it uses a different boot structure. Tip: BOOTREC can be thought of as the replacement for the Recovery Console that was used in Windows XP.
To run the tool, you must boot from the installation disc, choose the Repair Your Computer option and enter the Recovery Console. Choose Command Prompt from the System Recovery Options and then type bootrec.exe.
The options for BOOTREC are /FIXBOOT (to write a new boot sector), /FIXMBR (to write a new MBR), /REBUILDBCD (to rebuild the BCD store) or /SCANOS (to scan all disks for installations the Boot Manager menu is not listing).
SHUTDOWN
The SHUTDOWN.EXE utility can be used to schedule a shutdown (complete or a restart) locally or remotely. A variety of reasons can be specified and announced to users for the shutdown. Three parameters to be aware of are /S (turns the computer off), /R (restarts the computer) and /M (lets you specify a computer other than this one).
TASKLIST
The TASKLIST.EXE utility is used at the command line to see a list of all the running processes (and their process ID number), similar to what you see in the GUI by using Task Manager. By default, it shows the processes on the current machine, but the /S switch can be used to see the processes on a remote machine. /SVC will show the services hosted in each process and you can use /U if you need to run the command as another user (/P allows you to specify a password associated with that user).
MD
The MD command is used to make directories. It's a shorthand version of the MKDIR command. The following table describes its use and switches (we discuss RD and CD next).
CD, MD, and RD use and switches
Command |
Purpose
|
CD [path]
|
Changes to the specified directory.
|
CD /D [drive:][path]
|
Changes to the specified directory on the drive.
|
CD ..
|
Changes to the directory that is up one level.
|
CD\
|
Changes to the root directory of the drive.
|
MD [drive:][path]
|
Makes a directory in the specified path. If you don't specify a path, the directory will be created in your current directory.
|
RD [drive:][path]
|
Removes (deletes) specified directory.
|
RD /S [drive:][path]
|
Removes all directories and files in the specified directory, including the specified directory itself.
|
RD /Q [drive:][path]
|
Quiet mode. It won't ask whether you're sure you want to delete the specified directory when you use /S.
|
RD
The RD command is used to remove directories. It's a shorthand version of the RMDIR commands.
CD
The CD command is used to change (or display). It's a shorthand versions of the CHDIR command.
DEL
The DEL command is used to delete files and directories at the command line. Wildcards can be used with it. ERASE performs the same operations.
FDISK
The FDISK command used to be included with earlier operating systems to make disk partitioning possible. This command does not exist in Windows 7, Vista, or XP, having been replaced with DISKPART. CompTIA lists it as a command to know, and for the exam you should know that it is not included with the current versions of Windows.
FORMAT
The FORMAT command is used to wipe data off disks and prepare them for new use. Before a hard disk can be formatted, it must have partitions created on it. (Partitioning was done in the DOS days with the FDISK command, but as we just mentioned, that command does not exist in Windows 7, Vista, or XP, having been replaced with DISKPART.) The syntax for FORMAT is as follows:
FORMAT [volume] [switches]
The volume parameter describes the drive letter (for example, D:), mount point, or volume name. The following table lists some common FORMAT switches.
Switch |
Purpose
|
/FS:[filesystem]
|
Specifies the type of filesystem to use (FAT, FAT32, or NTFS)
|
/V:[label]
|
Specifies the new volume label
|
/Q
|
Executes a quick format
|
There are other options as well to specify allocation sizes, the number of sectors per track, and the number of tracks per disk size. However, we don't recommend that you use these unless you have a very specific need. The defaults are just fine.
So, if you wanted to format your D: drive as NTFS with a name of HDD2, you would type the following:
FORMAT D: /FS:NTFS /V:HDD2
Warning: Before you format anything, be sure you have it backed up or be prepared to lose whatever is on that drive!
|