Skip to content

Instantly share code, notes, and snippets.

@st0le
Forked from ReubenBond/killall.ps1
Created May 20, 2020 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save st0le/0cd46abd215ce9ae55ab6fcfa5788c7c to your computer and use it in GitHub Desktop.
Save st0le/0cd46abd215ce9ae55ab6fcfa5788c7c to your computer and use it in GitHub Desktop.
killall cmd for PowerShell with completion
# In a PS terminal, type "code $profile" and put this in there
function killall {
param(
[ArgumentCompleter(
{
param($cmd, $param, $values)
get-process |
? { $_.Name.StartsWith($values, [StringComparison]::OrdinalIgnoreCase) } |
Sort -Unique Name |
Select -ExpandProperty Name
}
)]
$ProcessName)
stop-process -Name $ProcessName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment