Solved

How to display seconds in NET TIME command?

Posted on 2008-10-30
4
3,865 Views
Last Modified: 2012-05-05
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
Comment
Question by:bobgato111
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 59

Expert Comment

by:Darius Ghassem
ID: 22846620
0
 
LVL 17

Expert Comment

by:Jared Luker
ID: 22847391
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
 
LVL 17

Expert Comment

by:Jared Luker
ID: 22847412
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
 
LVL 17

Accepted Solution

by:
Jared Luker earned 500 total points
ID: 22847419
You can also use 'echo %time%' in a batch file.  That will also give you a seconds reading.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question