How I can get the system uptime in milliseconds from the Windows command line? I want something like the result of this function: gettickcount()
, e.g. 24233241231
.
Is there a command, utility or trick for this?
How I can get the system uptime in milliseconds from the Windows command line? I want something like the result of this function: gettickcount()
, e.g. 24233241231
.
Is there a command, utility or trick for this?
You`re sure that you want the milliseconds via command line utility. IMHO the overhead starting a new process to fetch this will take a little bit to long.
If seconds also fits your requirements, here is a little outline to get with some bash code.
The further assumption is that you have some kind of unix. This example works on a current linux system.
# Reading the time of boot
bootTime=$(awk '/^btime/{print $2;}' </proc/stat)
currentTime=$(date +%s)
liveTime=$(( ${currentTime} - ${bootTime} ))
echo "online since: ${liveTime}"
systeminfo /FO list | findstr /C:"System Boot Time:"
.
Commented
Mar 13, 2013 at 21:25
For windows, execute the following text in command line: net stats srv