20.8 C
Texas
Melhttp://www.osradar.com
Guru Unix /Linux and GNU supporter

How to force close a program using PowerShell

How to force close a program using PowerShell

Hi! We have mentioned in the past that Windows allows you to open multiple programs at once. In fact, that is one of the aspects that makes it more attractive to users. Inasmuch as, it makes it possible to use the computer for different tasks. That is, for leisure, work or study. However, these applications can fail or even stop completely. The reasons may be because of inconveniences with the software or incompatibility. It is also possible that it is caused by insufficient hardware resources. In any case, these problems can cause damage to the system. We showed you before how to force the closing of programs using the task manager. However, today we will see how to force close a program using PowerShell.

How to view program PID or process Windows 10

Sometimes, the problem with the program or applications is so strong, that it resists being closed via task manager. In those cases, it is possible to use the PowerShell to force the closing of the program. However, it is necessary to go to the task manager, using any of the methods I detail here. Once there, just right click on some columns in the Processes tab. Then, please activate the PID option.

Enabling the PID in the open processes.
Enabling the PID in the open processes.

As shown in the following image, each open process is with the PID:

How to force application shutdown in Windows 10 from PowerShell

- Advertisement -

The first thing you have to do is open a PowerShell with administrator privileges. With this in mind, please press the Win+X combination. Once the Quick Link menu is open, select the corresponding option:

Please launch a PowerShell with administrator privileges.
Please launch a PowerShell with administrator privileges.

Stopping a process with PID

After opening the console, it is necessary to use the following syntax.

Stop-Process -Id PID

Please remember to substitute PID for the value of the problem process. Sometimes, the console will ask you to confirm the order.

Stopping a process from PowerShell
Stopping a process from PowerShell

Back to the task manager, you can see that the process is no longer active.

Stop a process using its name

It is also possible to stop a process using its name. With this in mind, please use the following syntax.

Stop-Process -Name process name

Once again, remember to replace the process name with the corresponding value.

Stopping a process using its name in PowerShell
Stopping a process using its name in PowerShell

Force close program

We can use the taskkill command for this purpose. With this in mind, please run taskkill next to the program’s PID to close it:

taskkill /F /PID pid

Again, assign the corresponding PID to the program.

Closing a program
Closing a program

Force close program processes

It is possible to use taskkill to close all processes linked to a program. To do this, run the following:

taskkill /IM program.exe
Force close program processes
Force close program processes

Force close program with name

Another way to close a program is to use its name again. But this time forcing the task. With this intention, execute the following:

Stop-Process -Name program -force

Conclusion

Finally, we have seen how to force close a program using PowerShell. Also, along post we studied several options to close those frozen apps. This option is very useful, when the program refuses to close by the traditional method. All right, this is all for now. See you soon!

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article