LOG - Save a log of commands
Purpose: Save a log of commands to a disk file.
Format: LOG [/H /W file ] [ON | OFF | text ]
file : The name of the file to hold the log.
text : An optional message that will be added to the log.
/H(istory log) /W(rite to).
See also: HISTORY.
Usage
LOG keeps a record of all internal and external commands you use, whether
they are executed from the prompt or from a batch file. Each entry
includes the current system date and time, along with the actual command
after any alias or variable expansion. You can use the log file as a
record of your daily activities.
LOG with the /H option keeps a similar record called a "history log".
The history log records only commands entered at the prompt; it does not
record batch file commands. In addition, the history log does not record
the date and time for each command, and it records commands before
aliases and variables are expanded.
The two logging options are independent. You can have both a regular log
and a history log enabled simultaneously.
By default, LOG writes to the file CMD.EXELOG in the root directory of
the boot drive. The default file name for the history log is
CMD.EXEHLOG. You can set the default log file names on the Options 2
page of the OPTION dialogs, or with the LogName and HistLogName
directives in CMD.INI.
Entering LOG or LOG /H with no parameters displays the name of the log
file and the log status (ON or OFF):
[c:\] log
LOG (C:\CMD.EXELOG) is OFF
To enable or disable logging, add the word "ON" or "OFF" after the LOG
command:
[c:\] log on
or
[c:\] log /h on
Entering LOG or LOG /H with text writes a message to the log file, even
if logging is set OFF. This allows you to enter headers in the log file:
[c:\] log "Started work on the database system"
The LOG file format looks like this:
[date time] command
where the date and time are formatted according to the country code set
for your system.
The LOG /H output can be used as the basis for writing batch files.
Start LOG /H, then execute the commands that you want the batch file to
execute. When you are finished, turn LOG /H off. The resulting file can
be turned into a batch file that performs the same commands with little
or no editing.
You can have both a regular log (with time and date stamping) and a
history log (without the time stamps) enabled simultaneously.
Options
/H: (History log) This option makes the other options on the
command line (after the /H) apply to the history log. For
example, to turn on history logging and write to the file
C:\LOG\HLOG :
[c:\] log /h /w c:\log\hlog
/W: (Write) This switch specifies a different filename for the LOG
or LOG /H output. It also automatically performs a LOG ON
command. For example, to turn logging on and write the log to
C:\LOG\LOGFILE :
[c:\] log /w c:\log\logfile
Once you select a new file name with the LOG /W or LOG /H/W
command, LOG will use that file until you issue another LOG /W
or LOG /H/W command, or until you reboot your computer.
Turning LOG or LOG /H off or on does not change the file
name.
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs