I am aware that one can print batch time up to the centisecond with @echo %time%
. Is there a similar command to get milliseconds as well?
相关问题
- How to get the return code of a shell script in lu
- Inheritance impossible in Windows Runtime Componen
- how to get running process information in java?
- Is TWebBrowser dependant on IE version?
- How can I have a python script safely exit itself?
相关文章
- 使用2台跳板机的情况下如何使用scp传文件
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- In IntelliJ IDEA, how can I create a key binding t
- Warning : HTML 1300 Navigation occured?
- shell中反引号 `` 赋值变量问题
- How get the time in milliseconds in FreeBSD?
- Bundling the Windows Mono runtime with an applicat
Gnu
gdate
can make this very simple; try the code below in a batch file, for instance. I use it to create unique filenames for batch processes invoked in command windows, and on my system under Windows 7 it's evident that, at least in a command window, two immediately successive uses of gdate never give identical results.But I actually use something more like the line below, discarding the last five digits because for my purposes they never seem to matter: the preceding part is always unique. This lets the unique file names be shorter.
Pretty obviously, the same expression works under Linux, so one can also use it there.
ptime utility is "5ms or better" accurate
There is a resource kit utility named Timethis that provides up to the millisecond time measurements :
(Edit: doh, didn't notice that this has the windows tag. Leaving the answer here in case anyone else clicked on this for Linux)
If you are asking to time the execution length of a program or script, precede the command with
time
, for example:and this will give you execution time in milliseconds:
If you are asking for the current date and time:
Take a look at:
For example,
This will give you the current time in Hour:Minutes:Seconds and then the Nanoseconds
Hope this answers your question
Use
wmic os get LocalDateTime
. That's also the reliable way to get locale-independent date and time