I need to get the current time-stamp in milli-seconds since the Unix epoch.
I got
WScript.Echo DateDiff("s", "01/01/1970 00:00:00", Now())
from answer to this question:
Is there a way to get epoch time using a Windows command?
but it doesn't support "ms"
for the first parameter.
Is there a way to get the above mentioned timestamp in millisecond, using CScript or any other method runnable from .bat
or as a CScript?
C:\>for /f "tokens=1,2 delims=.," %a in ('powershell Get-Date -UFormat %s') do echo %a%b
if you intend to use this in batch script you'll need double %
or
C:\>powershell [float](Get-Date -UFormat %s)*1000