Most users live for general applications. Word
processors, spreadsheets, graphics, productivity enhancers, and other
applications all serve the user's needs in some way. Of course, the
operating system also runs applications and you'll find more than a few
services and other low-level tasks running. In fact, even a
well-maintained system will run 25 or more tasks and most run far more.
Most users have no idea which applications are running on their systems,
but using the utilities in this book, you can discover what those
applications are, who's running them, and what the application is
supposed to do. The following sections describe three helpful utilities
for managing applications on your system.
1. Terminating Tasks with the TaskKill Command
You have a number of
ways to kill tasks on a system, but sometimes you have to kill a task by
remote control or use the command line to do it. The TaskKill
command fulfills both needs. It lets you maintain control over a
system, even if you have to use a network connection to do it. This
command uses the following syntax:
TASKKILL [/S system [/U username [/P [password]]]] { [/FI filter] [/PID processid | /IM imagename] } [/F] [/T]
The following list describes each of the command line arguments.
/S system
Specifies the remote system that you want to check. In most cases, you'll also need to supply the /U and the /P command line switches when using this switch.
/U [domain\]user
Specifies the
username on the remote system. This name may not match the username on
the local system. You'll need to supply a domain name when working with a
domain controller.
/P [password]
Specifies the
password for the given user. You can provide the command line switch
without specifying the password on the command line in cleartext. The
system prompts you for the password. Using this feature can help you
maintain the security of passwords used on your system.
/FI Filter
Filters the
output information from the utility. The filters can become complex, so
read the text that appears after this list for additional information. Table 1 describes the filter criteria.
Table 1. An Overview of TaskKill and TaskList FiltersFilter | Description | Comparison Operators | Valid Values |
---|
STATUS | Use this filter to locate any applications that are no longer responding so that you can manually end them. | eq, ne | Running or Not Responding | IMAGENAME | Use this filter to locate a particular application in the list based on its filename. | eq, ne | The executable filename | PID | Use this filter to locate a particular instance of an application when there's more than one copy of the application running. | eq, ne, gt, lt, ge, le | Process Identifier | SESSION | Unless
you're using a sharing application such as Terminal Services, this
filter is useless because every application running is for the current
session. | eq, ne, gt, lt, ge, le | The session number | SESSIONNAME | Unless
you're using a sharing application such as Terminal Services, this
filter is useless because every application running is for the current
session. | eq, ne | The name of the session | CPUTIME | Use
this filter to locate applications that have just started or have been
running a long time. For example, you might notice a sudden drop in
system performance and can use this filter to locate applications that
have just started to help determine which application might have caused
the performance problem. | eq, ne, gt, lt, ge, le | The amount of time that the application has used the CPU in hours, minutes, and seconds since the session has started | MEMUSAGE | Sometimes
you have more applications loaded than the system can comfortably
support. Use this filter to locate applications that you can end or
possible candidates for removal from the system. | eq, ne, gt, lt, ge, le | The amount of memory the application uses in kilobytes | USERNAME | Use this filter to separate applications that the user starts from those the system starts. | eq, ne | The name of the user who started the application | SERVICES | Use this filter to locate the application hosting a particular service on the system. | eq, ne | A service name | WINDOWTITLE | Use this filter to locate a particular application based on the name it displays to the user. | eq, ne | The name the application displays to the user on the title bar | MODULES | Use
this filter to locate applications based on the modules they use. You
can use this filter to help locate a variety of problems, including DLL
conflicts (when two applications use the same DLL, but they each need a
different DLL version). | eq, ne | The filenames of any modules that an application uses |
/PID processid
Specifies the Process Identifier (PID) of the process that you want to terminate.
/IM imagename
Specifies the
image name (application name) of the process that you want to terminate.
You can use wildcard characters to terminate multiple applications.
/F
Forces the
process to terminate. Using this option can cause data loss by
terminating an application before it has saved any changes the user had
made.
/T
Terminates the process and any processes started by the process. The TaskKill
command removes all of the processes that the application creates. This
is the best option to use for an application that has frozen because
there isn't any guarantee the application will clean up after itself.
|