Tuning ps command in PowerShell

This commit is contained in:
Martin Blazik
2020-10-02 08:06:06 +02:00
parent 816ac7b4c8
commit 0db6834f91

View File

@@ -1,11 +1,20 @@
# PowerShell profile script
Set-Alias ps Get-Process
Set-Alias kill Stop-Process
# ex: ps *mosh* | Add-Runtime | ft Name,StartTime,Status
filter Add-Runtime {
$_ | Add-Member -PassThru -NotePropertyName Status -NotePropertyValue (New-TimeSpan -Start $_.StartTime)
<#
.SYNOPSIS
Add Runtime property to each process object in pipeline
.EXAMPLE
ps *mosh* | Add-Runtime | ft Name,StartTime,Status
#>
$_ | Add-Member -PassThru -NotePropertyName Runtime -NotePropertyValue (New-TimeSpan -Start $_.StartTime)
}
function ps {
Get-Process @args | Add-Runtime
}
Set-Alias kill Stop-Process