Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
3  
Even though the command prompt is "aka DOS", it is not DOS. –  grawity Oct 26 '11 at 17:12

1 Answer 1

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

 
discard

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.