Page 1 of 1

Get time running from the Browser

Posted: 13 Feb 2020 08:01
by souza0010
Is it possible to reach the runtime of the application?
I have no idea how to do that!

Re: Get time running from the Browser

Posted: 13 Feb 2020 12:18
by penpen
You might be able to read it out of the following list:

Code: Select all

@echo off
>"tasklist.txt" tasklist /v
type "tasklist.txt"
penpen

Re: Get time running from the Browser

Posted: 13 Feb 2020 16:16
by Eureka!
Try it with

Code: Select all

wmic process where caption='notepad.exe' get creationdate /value
Result is the starttime of notepad.exe:

Code: Select all

CreationDate=20200213231040.876129+060
You will have to do your own arithmetic to get the running time from that :)
(there are several threads on this forum that can help you with that)

Re: Get time running from the Browser

Posted: 13 Feb 2020 17:52
by aGerman
Another approach

Code: Select all

@echo off &setlocal
set "proc=notepad"
for /f %%i in (
  'powershell -nop -ep Bypass -c "$ErrorActionPreference='SilentlyContinue';[string](New-TimeSpan (gps %proc%|foreach{$_.StartTime}|measure -minimum).minimum)"'
) do echo %%i
Also used notepad just as an example. If there is more than one process with the same name running (as it is usual for browser applications) it takes the process with the oldest start time.

Steffen