Is there a way to determine the 'uptime' of a process in Windows. Disappointed to find that it is not one of the attributes available when using the Task Manager.
7 Answers
This can be done using Powershell.
Run it as admin and then execute
Get-Process | select name, starttime
You will get a list of all running processes and their start times
Referenced from: http://blogs.technet.com/b/heyscriptingguy/archive/2012/11/18/powertip-use-powershell-to-easily-see-process-start-time.aspx
- 473
You can see this with Process Explorer. In the taskbar menu select View and check Show Process Tree and the Show Lower Pane options. Right click on any column and Select Columns, now click on the Process Performance tab and check the Start Time box.
Community Update:
As mentioned in the comments, in more recent versions of the tool (currently as of 2019), the information has been relocated into the image tab of the property sheets regarding each process-tree item (Just double-click the process name, no other steps are required).
- 139
- 18,171
In CMD you can use standard Windows Management Instrumentation Command-line (WMIC) utility to get the process start time:
wmic process where Name="<process name>" get CreationDate
or
wmic process where ProcessID="<PID>" get CreationDate
You'll get a datetime like this: 20201021010512.852810+180.
Format: YYYYMMDDHHMMSS.ssssss+MMM(UTC offset)
If you want a more readable representation you'd need to prep it with a script. Here I have written a little batch script for the purpose:
@ECHO OFF
SETLOCAL
IF [%1]==[] (
ECHO Prints process creation date in ISO format.
ECHO:
ECHO USAGE: %~n0 ^<PID or Process name^>
EXIT /B 1
)
IF [%~x1]==[.exe] (SET type=Name) ELSE (SET type=ProcessID)
FOR /F "tokens=1,2 delims==" %%a IN ('wmic process where %type%^="%~1" get CreationDate /value') DO (
IF [%%a]==[CreationDate] SET proc_cd=%%b
)
IF DEFINED proc_cd (
ECHO %proc_cd:~0,4%-%proc_cd:~4,2%-%proc_cd:~6,2%T%proc_cd:~8,2%:%proc_cd:~10,2%:%proc_cd:~12,2%
)
Feed it with a PID or a process name ending with .exe and it will output when the process was started. Caveat: If there are many processes with the same name it would output the time only for the last one started.
- 41
If you're on a server where you cannot install any external tool, you still can :
- Open the task manager
- Click on the process tab
- Locate your process
- Right click on it
- Select the Properties option
You can see a "creation date" right there, which should be the creation date of your process. With a simple substraction you can deduce the uptime.
- 132
- 6
Open Task Manager and right-click on the process. Choose Properties in the menu and look at the field Accessed in the first tab. Unless multiple instances have been started this will give you the start time of the process.
- 231
With the PID from Task Manager, you can use the following Powershell command with the implied -End (Get-Date):
New-Timespan -Start (Get-Process -Id PID).StartTime
- 11
maybe you can try procxp http://technet.microsoft.com/en-us/sysinternals/bb896653
- 2,134
