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)

link|improve this question

50% accept rate
2  
Even though the command prompt is "aka DOS", it is not DOS. – grawity Oct 26 '11 at 17:12
feedback

1 Answer

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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