PowerTip: Use PowerShell to Easily Find How Long a Process Runs

Doctor Scripto

Summary: Use Windows PowerShell to show easily how long a process runs.

Hey, Scripting Guy! Question You need to find how long a particular process has been running. How can you easily do this with Windows PowerShell?

Hey, Scripting Guy! Answer Use the New-TimeSpan cmdlet and specify the –Start parameter as the results from Get-Process on a process and the StartTime property. This is shown here using Notepad as an example.

PS C:\> New-TimeSpan -Start (get-process notepad).StartTime

 

Days       : 0

Hours       : 6

Minutes      : 53

Seconds      : 54

Milliseconds   : 55

Ticks       : 248340555164

TotalDays     : 0.287431198106481

TotalHours    : 6.89834875455556

TotalMinutes   : 413.900925273333

TotalSeconds   : 24834.0555164

TotalMilliseconds : 24834055.5164

 

0 comments

Discussion is closed.

Feedback usabilla icon