In the command line, how do I write a displayed date to file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am writing a .bat script to install some software. At the same time, I like it to write to file to document its steps, leavining me with an installation document I can file

I have done this numerous times in other operating systems, and may have done this in DOS in the past. But to do it in the command line, I need a way to display the date and time to the file without it prompting for new a new date and time and thus interupting the script. How do I do this

sjl
 
Steve said:
I am writing a .bat script to install some software. At the same time, I like it to write to file to document its steps, leavining me with an installation document I can file.

I have done this numerous times in other operating systems, and may have done this in DOS in the past. But to do it in the command line, I need a way to display the date and time to the file without it prompting for new a new date and time and thus interupting the script. How do I do this?
Hi

Note there is a separate newsgroup for this type of questions:
microsoft.public.win2000.cmdprompt.admin


Take a look at the /T option, output from date /?:

C:\>date /?
Displays or sets the date.

DATE [/T | date]

Type DATE without parameters to display the current date setting and
a prompt for a new one. Press ENTER to keep the same date.

If Command Extensions are enabled the DATE command supports
the /T switch which tells the command to just output the
current date, without prompting for a new date.
 
I found the answer.

By typing "help date" in the command line, I found that I
could use the /t switch with it and the time command to
force the date and time to display without prompting for a
new one.

Sorry to bother you.

sjl
-----Original Message-----
I am writing a .bat script to install some software. At
the same time, I like it to write to file to document its
steps, leavining me with an installation document I can
file.
I have done this numerous times in other operating
systems, and may have done this in DOS in the past. But
to do it in the command line, I need a way to display the
date and time to the file without it prompting for new a
new date and time and thus interupting the script. How do
I do this?
 
There is a simpler solution too:

echo %date% %time% > SomeFile.txt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top