Home » questions » MS-DOS time command?

MS-DOS time command?

2006-08-16 13:18:22, Category: Programming & Design
I want to be able to use the time command without it saying "Enter new time" afterwards so that I can place the time into a log (like time >> c:\timelog.log for example). How can I do this? I want to do the same thing with the date command as well. Slightly unrelated, but I also forgot how to echo a blank line, could you tell me how to do that as well? No you don't understand - if you type "time" at a prompt, it gives you the time and the says "Enter New Time" - I don't want it to say that because I want to save it to a text file. No Jono, just typing echo does not leave a blank line, it tells you if echo is on or off. Thanks for the /t thing, works great.

Answers

  1. Neussendorfera

    On 2006-08-16 13:31:11


    actually enter "time /t" for date "date /t" this will just bring up the time and date without prompting you to enter a new time or date
  2. Laurie S

    On 2006-08-16 13:25:13


    At the c: prompt....just type time this should give you the time of your system
  3. freehandorb

    On 2006-08-16 14:25:20


    Using Barrytabrah's suggestion, I have just run a batch file with the following lines echo. | time/t >> c:\timelog.log echo. | date/t >> c:\timelog.log This created the log file, and added these lines to the file 22:07 16/08/2006
  4. jono

    On 2006-08-16 13:37:03


    time > c:\time.log ECHO blanks a line
  5. barrytabrah

    On 2006-08-16 13:35:50


    Your best option is to use a pipe or | On a UK keyboard the key is located to the left of the Z key on the same key as the backslash. The full command would be; echo. | time >> timelog.log The 'echo.' sends a return character to the piped command, in this case 'time'. The text file will still say; The current time is: 21:31:30.47 Enter the new time: but the command will complete without requiring an input. The 'time' command will never just display the time. If you want that you will have to find a small program that can do that for you. Can't find one right now. Feel free to email me and I might be able to write one for you. :)