Tuning ps command in PowerShell
This commit is contained in:
@@ -1,11 +1,20 @@
|
|||||||
# PowerShell profile script
|
# 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 {
|
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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user