Write to Windows event log: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: removed STYLE from the PRE html tag.) |
Simple9371 (talk | contribs) (Added Batch File) |
||
Line 193: | Line 193: | ||
return char_count |
return char_count |
||
}</lang> |
}</lang> |
||
=={{header|Batch File}}== |
|||
The "EventCreate" command does the task. |
|||
<lang>@echo off |
|||
EventCreate /t ERROR /id 123 /l SYSTEM /so "A Batch File" /d "This is found in system log." |
|||
EventCreate /t WARNING /id 456 /l APPLICATION /so BlaBla /d "This is found in apps log" |
|||
</lang> |
|||
{{Out}} |
|||
<pre>>EventLog.BAT |
|||
SUCCESS: An event of type 'ERROR' was created in the 'SYSTEM' log with 'A Batch File' as the source. |
|||
SUCCESS: An event of type 'WARNING' was created in the 'APPLICATION' log with 'BlaBla' as the source. |
|||
></pre> |
|||
If you do not want the command to display its result or errors... |
|||
<lang>@echo off |
|||
EventCreate /t ERROR /id 123 /l SYSTEM /so "A Batch File" /d "This is found in system log." 2>NUL>NUL |
|||
EventCreate /t WARNING /id 456 /l APPLICATION /so BlaBla /d "This is found in apps log" 2>NUL>NUL |
|||
::That "2>NUL>NUL" trick actually works in any command!</lang> |
|||
=={{header|BBC BASIC}}== |
=={{header|BBC BASIC}}== |