Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running a batch script to retrieve information from a device. Tieing this up with a separate log file requires accuracy greater than the minute accuracy I can get using time /t.

This question has a method I wasn't aware of using wmic, but that only allows access to time up to 1 second accuracy (technically, you can ask for milliseconds - but the answer is always NULL).

share|improve this question
Even though the command prompt is "aka DOS", it is not DOS. – grawity Oct 26 '11 at 17:12

I had forgotten that the command prompt has some built in variables.

Use %TIME%

set dt=%DATE%-%TIME%
echo %dt%

gives 26/10/2011-15:08:19.09

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.