Stopping a Process with PowerShell
To stop a process, such as Chrome, in PowerShell, you can use the Stop-Process
cmdlet. This is equivalent to using taskkill
in the Command Prompt. Here’s how you do it:
stop-process -Name "chrome" -Force
Using the Command in a Batch File
If you’re working with batch files and need to incorporate PowerShell commands, you can do so with the following syntax:
powershell -command stop-process -Name "chrome" -Force
Listing Processes
To list all the currently running processes, you can use the Get-Process
cmdlet in PowerShell:
get-process
Using Wildcards
PowerShell allows the use of wildcards for matching process names, which can be very handy. For example, to stop all processes that start with « chrome », you can use:
Get-process –name "chrome*" | stop-process
0 commentaire