For all I know, Batch does not have a command that gives the UNIX time. The closest one I can find is %time%, which only displays the timestamp.
Is there a command, or set of commands in Batch with which you can get the UNIX time?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s Richie Lawrence’s batch library that has all those nifty handy scripts. The one you need is DateToSec (which uses GetDate and GetTime).
Here’s a simplified script, that employs a little WMI:
The result will be returned into the first parameter passed to
GetUnixTime, i.e.%UNIX_TIME%.For example:
Hope it helps!