Get time running from the Browser

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
souza0010
Posts: 1
Joined: 13 Feb 2020 07:58

Get time running from the Browser

#1 Post by souza0010 » 13 Feb 2020 08:01

Is it possible to reach the runtime of the application?
I have no idea how to do that!

penpen
Expert
Posts: 1777
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Get time running from the Browser

#2 Post by penpen » 13 Feb 2020 12:18

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

Eureka!
Posts: 71
Joined: 25 Jul 2019 18:25

Re: Get time running from the Browser

#3 Post by Eureka! » 13 Feb 2020 16:16

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)

aGerman
Expert
Posts: 3828
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Get time running from the Browser

#4 Post by aGerman » 13 Feb 2020 17:52

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

Post Reply