Most computer programs are closed quite traditionally - by choosing the Exit (Quit) option in the menu or by clicking the cross in the upper right corner of the program window. But sometimes it becomes necessary to close a program or "kill" a process from the command line.
Instructions
Step 1
The reasons why a user might need to close a program from the command line can be very different. For example, it is necessary to close a frozen program that cannot be stopped by other means, or there is a need to “kill” some suspicious process detected during a computer scan. In addition, this is the way to close the program on the remote computer.
Step 2
Let's consider closing a program from the command line using the Notepad text editor as an example. Open it: "Start" -> "All Programs" -> "Accessories" -> "Notepad". Now open Command Prompt: Start -> All Programs -> Accessories -> Command Prompt. You can also open it by selecting: "Start" -> "Run", then typing cmd in the field that appears and pressing Enter.
Step 3
The command line is open. Now you need to find out the list of processes - for this, enter the tasklist command and press Enter. A list of all processes running on the system will appear. Find the line notepad.exe - this is the process of the text editor we have opened. Pay attention to the column of numbers immediately following the names of the processes - this is the PID, the process identifier.
Step 4
The process itself can be completed in two ways. The first is using the name (name of the image) of the process. To close Notepad, at a command prompt, type taskkill / f / im notepad.exe. Here, the f parameter is the choice of forceful program termination. The im parameter indicates that the name of the process image is used. Press Enter - the text editor will immediately close.
Step 5
The second, simpler way is related to the use of the process ID. For example, the process notepad.exe has a PID of 4024 (yours will most likely have a different one). To close the program, type in the command line: taskkill / pid 4024, press Enter. Process 4024 corresponding to the text editor will be killed and Notepad will close. In this way, you can terminate most processes, excluding critical system processes - the operating system will not allow them to be terminated.