Закрыть программу из командной строки windows

Если какая-то из программ в Windows не отвечает, не закрывается стандартными средствами или вам потребовалось закрыть её принудительно по другим причинам, сделать это можно несколькими способами.

В этой инструкции подробно о способах принудительного закрытия программ в Windows 11 или Windows 10. Большинство из них подойдёт и для предыдущих версий системы.

Диспетчер задач

Один из самых часто используемых способов для принудительного закрытия программ Windows — диспетчер задач. Шаги будут следующими:

  1. Откройте диспетчер задач, сделать это можно с путем нажатия клавиш Ctrl+Shift+Esc или через меню, открываемое сочетанием клавиш Ctrl+Alt+Delete.
  2. В списке запущенных программ или на вкладке «Сведения» (в Windows 11) или «Подробности» (в Windows 10) выберите нужную программу или соответствующий ей процесс.
    Принудительное завершение процесса в диспетчере задач Windows 11

  3. Нажмите по кнопке «Завершить задачу» (в Windows 11, может быть скрыта за кнопкой с тремя точками в верхней панели) или «Снять задачу» (в Windows 10).
    Принудительное завершение процесса в диспетчере задач Windows 10

  4. Подтвердите принудительное завершение выбранного процесса.
    Подтвердить завершение программы в диспетчере задач

Принудительно завершая работу программы следует учитывать несколько нюансов:

  • Если в программе велась работа, изменения в файле, над которым вы работали, вероятнее всего будут потеряны.
  • Завершение важных системных процессов Windows может приводить к сбоям.
  • Некоторые завершаемые процессы могут перезапуститься автоматически: это относится к важным системным процессам, а иногда и к вредоносным программам.

Если ваша задача — проверка работы системы без сторонних сервисов и процессов, вы можете использовать режим чистой загрузки Windows вместо ручного закрытия таких процессов.

Командная строка

Следующий способ — принудительное закрытие программы в командной строке, для этого:

  1. Запустите командную строку, лучше — от имени администратора (как это сделать).
  2. Введите команду
    taskkill /im имя_файла_программы.exe /f /t

    и нажмите Enter.

    Принудительное завершение программы в командной строке

  3. Указанный процесс и его дочерние процессы будут закрыты.

Учитывайте: если запущено несколько экземпляров программы с заданным в команде именем, все они будут закрыты.

Если вам требуется закрыть лишь один из экземпляров, используйте следующий вариант команды, заменив ИД_ПРОЦЕССА на соответствующий идентификатор (как узнать ИД процесса или PID):

taskkill /pid ИД_ПРОЦЕССА /f /t

Windows PowerShell или Терминал Windows

Вместо классической командной строки можно использовать Терминал Windows или Windows PowerShell для прекращения работы процесса:

  1. Запустите Терминал Windows или PowerShell (в Windows 11 и Windows 10 для этого можно использовать контекстное меню по правому клику на кнопке «Пуск»).
  2. Используйте команду
    Stop-Process -Name "имя_программы" -Force

    для принудительного закрытия выбранной программы по её имени (а точнее — всех экземпляров этой программы, запущенных на компьютере).

    Принудительное завершение программы в PowerShell

  3. Используйте команду
    Stop-Process -id ИД_ПРОЦЕССА -Force

    для завершения процесса с указанным идентификатором.

Дополнительные сведения, которые могут пригодиться при принудительном закрытии программы:

  • Для некоторых, не зависших программ, может сработать простое нажатие клавиш Alt+F4 для закрытия (Alt+Fn+F4 на некоторых ноутбуках).
  • Если речь идет о полноэкранной программе, и вы не можете попасть в Windows, попробуйте использовать сочетание клавиш Win+D (свернуть все окна) или Alt+Enter (переход из полноэкранного в оконный режим, работает не во всех программах).

В контексте зависших и не отвечающих программ на сайте есть отдельная инструкция: Как завершить зависшую программу в Windows 11 или Windows 10.

Sooner or later, you’re going to have to deal with a program that won’t stop misbehaving. A buggy program can cause all kinds of problems, and that includes refusing to close.

Sure, you could use the Task Manager or press the Ctrl + Alt + Del keys, but there are other options. One of those options is closing a process by using the Command Prompt as an administrator.

Contents

  • 1 How to Force Close Any Program – Windows 10
  • 2 Close Any Program with PowerShell
    • 2.1 Conclusion

How to Force Close Any Program – Windows 10

To close a task without using the Task Manager is a two-step process. First, you need to know the program’s PID or image name. You can get this data by typing tasklist and pressing Enter.

To force close a program, you can use the image name or the PID. For example, to close a program with the image name, you’ll need to enter the following: Taskkill /IM “NordVPN.exe” /F. The commands are easy to read. /IM refers to the image name, and /F is to force close the program despite any difficulties.

To force close a p process using the PID, your command will need to look like this:

Taskkill /PID #### /F

Don’t forget to replace the # for the PID. You might want to close a program using the PID when various processes have the same image name. To see more options, you can use type taskkill /? in the Command Prompt. Among many other options, you’ll see useful tips such as what command to use to close a group of processes by using taskkill /PID 2523 /PID 1422 /PID 5653 /T.

Close Any Program with PowerShell

If you’re more of a PowerShell fan, it’s also possible to force-close a program with this program. To open PowerShell, right-click on the Windows start menu and click on PowerShell Administrator.

If you’re not sure if you’re running a specific process, you can check by typing Get-Process, followed by the Enter key. Once you’ve found the process, you want to stop, enter the following command: Stop-Process -Name “ProcessName” -Force.

To kill a process using the PID, you’ll need to enter: Stop-Process -ID PID -Force.

Conclusion

For those times when clicking the x to close a program just won’t work, you know you can always count on the Command Prompt or the PowerShell. They’ll both get the job done, it’s just in case you have either one open at the time.

Закрыть зависшее приложение можно через терминала или командную строку Windows 11. В строке поиска Windows 11 (клавиши «Win+S») набираем «Терминал» и запускаем его с правами администратора.

В окне «Контроль учетных записей» нажимаем на кнопку «Да».

В окне терминала вводим команду:

tasklist

чтобы отобразить список всех активных процессов на ПК.

Используем команду:

taskkill /im имя_процесса.exe /t /f

чтобы завершить процесс. 

Процесс можно «убить» так же используя его PID («ProcessID» — идентификатор процесса, число, отображаемое во второй колонке). Для этого используем команду:

taskkill /pid ID_процесса /t /f

Для выполнения команды используем клавишу «Enter».

Загрузить PDF

Загрузить PDF

Порой необходимо принудительно закрыть программу, которая не отвечает на действия пользователя. Это можно сделать несколькими способами в зависимости от характера сбоя программы и используемой вами операционной системы.

  1. Step 1 Нажмите Ctrl + Alt + Del.

    Это приведет к появлению экрана с четырьмя опциями: «Блокировать компьютер», «Сменить пользователя», «Выйти из системы» и «Запустить диспетчер задач».

  2. Step 2 Нажмите «Диспетчер задач».

    Диспетчер задач содержит информацию о запущенных процессах, службах и программах.

  3. Step 3 Перейдите в окно диспетчера задач.

    Возможно, щелкнув по «Диспетчер задач», вы не увидите открывшегося окна, так как оно будет скрыто за окном зависшей программы. В этом случае нажмите Alt+Tab , чтобы перейти в окно диспетчера задач.

    • Во избежание подобных проблем в окне диспетчера задач (в его верхнем левом углу) нажмите «Параметры» – «Поверх остальных окон».
  4. Step 4 Найдите и выделите зависшую программу.

    Перейдите на вкладку «Приложения». У зависшей программы в столбце «Состояние» будет значиться «Не отвечает».

  5. Step 5 Нажмите «Снять задачу».

    Выделив зависшую программу, нажмите «Снять задачу» (в правом нижнем углу окна диспетчера задач). В открывшемся окне нажмите «Закрыть программу».

    Реклама

Устранение неполадок

  1. Step 1 Перейдите на вкладку «Процессы».

    Если завершение работы программы на вкладке «Приложения» не сработало, необходимо завершить процесс этой программы. Если вы работаете в Windows 8, нажмите «Дополнительно» (в нижней части окна диспетчера задач), а затем перейдите на вкладку «Процессы».

  2. Step 2 Найдите и выделите соответствующий процесс.

    На вкладке «Процессы» отображается намного больше процессов, чем программ на вкладке «Приложения», так как учитываются процессы, работающие в фоновом режиме. Возможно, вам придется потратить немного времени, чтобы найти процесс зависшей программы.

  3. Step 3 Нажмите «Завершить процесс».

    Выделив процесс зависшей программы, нажмите «Завершить процесс» (в нижней правой части окна диспетчера задач).

    Реклама

  1. Step 1 Запустите командную строку от имени администратора.

    Нажмите Win и введите CMD. Щелкните правой кнопкой мыши по значку командной строки и в меню выберите «Запуск от имени администратора».

    • Если откроется всплывающее окно, нажмите в нем «Да».
  2. Step 2 Закройте зависшую программу.

    В командной строке введите taskkill /im filename.exe и нажмите Enter. Вместо filename введите имя зависшей программы. Например, если вы хотите закрыть iTunes, введите команду taskkill /im itunes.exe.

    Реклама

  1. Step 1 Запустите Force Quit.

    Нажмите Command + Option + Escape, чтобы открыть окно Force Quit. Отобразится список всех запущенных программ.

  2. Step 2 Принудительно закройте зависшую программу.

    Найдите и выделите зависшую программу, а затем в правом нижнем углу окна нажмите «Force Quit» (Завершить принудительно).

    Реклама

Советы

  • Если описанные выше способы не сработали, перезагрузите компьютер. Возможно, это единственно доступный вариант, но в этом случае вы рискуете потерять результаты вашей работы. Зажмите кнопку питания, чтобы выключить компьютер; включите его спустя некоторое время.

Реклама

Об этой статье

Эту страницу просматривали 25 656 раз.

Была ли эта статья полезной?

Multitasking with many apps and programs in the background can become difficult to manage and kill the processes running in the background using just the Task Manager or even with tools like Microsoft Process Explorer. However, another way to kill tasks and processes is from the command line in Windows.

However, you can open the Task Manager, right-click the process, and then click “End Task” to kill off the process. You can also terminate a specific process from the Details tab in the Task Manager. Sometimes you encounter issues with the Task Manager itself. For times like these, you may need to kill a process using the command line, which includes both the Command Prompt and Windows PowerShell.

In this article, we show you multiple ways to kill a process in Windows using Command Line.

Table of Contents

Why use the command line to terminate a process?

Although a normal user will not require killing processes using the command line, there are several use cases where command line tools are much better than their visual counterparts like the task manager. The following command line tools can be used in the following scenarios:

  • Troubleshooting: Some processes are simply stubborn. They just stop responding and refuse to die. In such a condition, killing them forcefully using the command line is an easier and safer option.
  • System administration: If you are a sysadmin, you should be a fan of command line utilities. These tools save a lot of work and time. You can run these commands remotely throughout your network to troubleshoot systems remotely.
  • Script Automation: If you are a developer and need to start or stop processes in Windows, you will need these command line tools for automation.
  • Virus prevention: If your system gets infected with viruses, it will simply not let you kill the compromised processes, as they will respawn upon kill. In this case, you can automate a monitoring process where the process is killed as soon as it starts.

There are several other use cases, but these are the most common ones.

How to Kill a Process from Command Prompt

You can kill the process in cmd using the taskkill command. However, you must either know its Process Identifier (PID) or the name of the process before you can end it.

To view and list the tasks and processes currently running on your computer, run the following command in an elevated Command Prompt:

Tasklist
List all running processes

List all running processes

Note either the name under the Image name column or the PID number of the task you want to kill. These will be used in the cmdlets to kill the respective process.

Once you have either the name or the PID of the task, use either of the following cmdlets to kill the process:

  • Kill task using process name in Command Prompt:

    Replace [ProcessName] with the name of the process.

    taskkill /IM "[ProcessName]" /F
    Kill process from Command Prompt using process name

    Kill process from Command Prompt using process name
  • Kill task using PID in Command Prompt:

    Replace [PID] with the Process ID.

    taskkill /F /PID [PID]
    Kill process from Command Prompt using process ID

    Kill process from Command Prompt using a process ID

If you are using earlier versions of Windows, like Windows 7, Windows Vista or even Windows XP, you can use tskill command, which is similar to taskkill but limited in functionality. You just need to provide the process ID to kill a task using tskill command:

tskill process-id

Replace process-id with the actual process ID. For example,

tskill 1234

How to Kill a Process from Windows PowerShell

Similar to the Command Prompt, you can also kill processes using PowerShell. But first, we must get the name or the process ID for the process to kill.

To obtain a list of the running processes in PowerShell, run the following command in PowerShell with elevated privileges:

Get-Process
List all running processes in PowerShell

List all running processes in PowerShell

From here, note down the process name or the PID (in the ID column) of the process that you want to kill, and then use it in the following commands:

Note: Unlike the Command Prompt, Windows PowerShell shows no output once a process is killed.

  • Kill task using process name in PowerShell:

    Replace [ProcessName] with the name of the process.

    Stop-Process -Name "[ProcessName]" -Force
    Kill process from PowerShell using process name

    Kill process from PowerShell using process name
  • Kill task using PID in PowerShell:

    Replace [PID] with the Process ID.

    Stop-Process -ID [PID] -Force
    Kill process from PowerShell using process ID

    Kill process from PowerShell using a process ID

How to Kill a Process using WMIC

Windows Management Instrumentation Command-Line (WMIC) is a useful command line tool to perform administrative tasks especially for sysadmins and power users. You can terminate the process using wmic command.

Please note all the below mentioned commands will only work if you open Command Prompt, PowerShell or Terminal as an administrator.

wmic process where "ProcessId='process-id'" delete

Replace process-id with the actual process ID. For example,

wmic process where "ProcessId='1234'" delete

You can also terminate the process using its name:

wmic process where "name='process-name'" delete

Replace process-name with the actual process name. For example,

wmic process where "name='Skype.exe'" delete

If there are multiple processes by the same name, this command will kill all of them. For example, the above mentioned command will delete all instances with the name Skype.exe.

wmic commands to delete a process

wmic commands to delete a process

How to Kill a Process using SysInternals PsKills

PsKill is a tiny tool that comes with the PsTools Suite by SysInternals. This is a command-line tool used to kill processes, both locally and remotely on other computers on the network.

Although it was designed for WindowsNT and Windows 2000 that did not include the other command-line tools (Killtask and Stop-Process), PsKill can still be used to end processes.

Learn how to manage processes and services on remote computers.

Use the following steps to download and use PsKill to kill tasks using the command line on a Windows computer:

  1. Start by downloading PsTools.

    Download PSTools

    Download PSTools
  2. Extract the contents of the PsTool file.

    Extract PsTools

    Extract PsTools
  3. Launch an elevated Command Prompt and then use the CD cmdlet to change your directory to the extracted PsTools folder.

    CD [PathToPsTools]
    Change directory to PsTools folder

    Change directory to PsTools folder
  4. Run the following command to list all the running processes:

    PsList
    List all running processes using PsList

    List all running processes using PsList

    Note down the name of the process that you want to kill.

  5. Now use the following command to kill a process using its name:

    PsKill.exe [ProcessName]
    Kill process using PsKill

    Kill process using PsKill

As you can see from the image above, the respective process will be killed, and the associated service or program will be terminated.

Ending Thoughts

Even without the use of the Task Manager, there are multiple ways of killing a task or a process directly from the command line. You can even use these commands in scripts to end a Windows process.

On top of that, you can choose whether to kill a process using its name or its PID. Either way, Command Prompt and Windows PowerShell can be used with both native and external commands for this purpose. Not only that, but you can also use these commands in Windows Terminal for the same purpose.

If you are a sysadmin who wants quick and convenient methods to kill running processes, the given command line methods just might be the most convenient way of accomplishing it.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Ошибка агента обновлений windows 80246010
  • Windows photo gallery на русском
  • Автозагрузка при запуске windows 10
  • Reanimator for windows xp
  • Ошибка восстановления системы windows 10 0x81000202