Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3925
  • Last Modified:

How to display seconds in NET TIME command?

I need to create a command file that checks the time (HHMMSS at least) on a remote server. When I issue a NET TIME command, I get the hours and minutes only. I need the seconds to display as well. Can you tell me how to do this (with cmd or vbs)?
0
bobgato111
Asked:
bobgato111
  • 3
1 Solution
 
Darius GhassemCommented:
0
 
Jared LukerCommented:
You can just type 'time /T' and hit enter.  It produces the seconds output:

The current time is: 21:13:54.46

With VBScript, you can use the NOW command and it will produce output like this:

10/30/2008 9:16:24 PM
wscript.echo Now

Open in new window

0
 
Jared LukerCommented:
It looks like time /t does not display the seconds.  Time all by itself will output the seconds, but then issues a prompt for a new time, so that's probably not what you want.  

I would use VBScript since it's so much more flexible.
0
 
Jared LukerCommented:
You can also use 'echo %time%' in a batch file.  That will also give you a seconds reading.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now