How to use the command tskill (with examples)
- Windows
- December 25, 2023
The tskill
command is used to terminate or end a process running in a session on a Remote Desktop Session Host. It can terminate a process either by its process identifier or by its name.
Use case 1: Terminate a process by its process identifier
Code:
tskill process_id
Motivation:
The use case of terminating a process by its process identifier is helpful when you know the specific process ID of the process you want to end. This is especially useful when dealing with multiple processes with the same name.
Explanation:
tskill
: The command itself, used to terminate a process.process_id
: The process identifier (PID) of the process you want to terminate.
Example output:
Suppose we want to terminate the process with a process ID of 1234, we would run the following command:
tskill 1234
The output would not have any specific message, but the process with the specified process ID would be terminated successfully.
Use case 2: Terminate a process by its name
Code:
tskill process_name
Motivation:
The use case of terminating a process by its name is useful when you don’t have the process ID but know the exact name of the process you want to end. This allows you to easily terminate a specific process without having to search for its process ID.
Explanation:
tskill
: The command itself, used to terminate a process.process_name
: The name of the process you want to terminate.
Example output:
Suppose we want to terminate a process named “notepad.exe”, we would run the following command:
tskill notepad.exe
The output would not have any specific message, but the process with the specified name would be terminated successfully.
Conclusion:
The tskill
command is a useful tool for terminating processes in a Remote Desktop Session Host. Whether you have the process ID or the process name, this command provides an efficient way to end specific processes, ensuring better control over your system resources.