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

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

  • Comments 1
  • Likes

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

 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • I was surprised to learn the same about your blog---  I loved it.I am

    a big fan of your blog.i am so excited by read of your blog's

    content.really great post.Thanks for sharing.

    <a href"drawsomethingcheat.ws/">draw something cheat

    </a>