Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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) } |
select name -Unique |
% { $_.Name } |
sort
}
)]
$ProcessName)
stop-process -Name $ProcessName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment