Jump to content

Write to Windows event log: Difference between revisions

m
→‎{{header|Batch File}}: Changed to the proper way to hide output (>NUL 2>&1)
m (→‎{{header|Batch File}}: Changed to the proper way to hide output (>NUL 2>&1))
Line 238:
If you do not want the command to display its result or errors...
<lang dos>@echo off
EventCreate /t ERROR /id 123 /l SYSTEM /so "A Batch File" /d "This is found in system log." 2>NUL 2>NUL&1
EventCreate /t WARNING /id 456 /l APPLICATION /so BlaBla /d "This is found in apps log" 2>NUL 2>NUL&1
::That "2>NUL 2>NUL&1" trick actually works in any command!</lang>
 
'''NOTE:''' This will (...or might) not work if you do not have administrator privileges.
535

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.