Purpose:Write a string to the Windows event log


Format:EVENTLOG [/S"source" /Cn /E /I /W] message


messageThe text to write.
sourceThe source for this message.





See also: HISTORY and LOG.




EVENTLOG posts messages to the Windows application event log. You cannot use the command separator character ([&]) or the redirection symbols (| > <) in an EVENTLOG message, unless you enclose the message in quotes or precede the special characters with the escape character.


By default, the text written with EVENTLOG is stored in the event log as informational messages. You can store warning and error messages by using the /W and /E switches.


Messages in the log can be reviewed with the Windows Event Log viewer.


If you do not have proper registry permissions when you execute the EVENTLOG command and/or the key cannot be created, EVENTLOG will fail and display an error. EVENTLOG is primarily intended for use by users with Administrator status. If you are running Windows 7 or later, you will also need to be running an elevated session.




/=Display the EVENTLOG command dialog to help you set the command line options. You cannot specify any other arguments on the command line.


/CnSet the event category. The value can be from 0-65535; Windows defines 0-7 as:
     0 - None
     1 - Devices
     2 - Disk
     3 - Printers
     4 - Services
     5 - Shell
     6 - System
     7 - Network


/EStore the message as an error entry in the event log.


/IStore the message as an informational entry in the event log. This is the default if no switch is used.


/SSpecify the event log entry source. If you use the /S option, it must be the first option on the EVENTLOG command line. If the source contains white space, it must be double-quoted. For example:
       eventlog /sCompiling /I Your message here.


/WStore the message as a warning entry in the event log.