Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.3 KiB

  1. @echo off
  2. REM ------------------------------------------------------------------
  3. REM
  4. REM errmsg.cmd
  5. REM Logs error messages to the screen and in a log file
  6. REM
  7. REM Copyright (c) Microsoft Corporation. All rights reserved.
  8. REM
  9. REM ------------------------------------------------------------------
  10. perl -x "%~f0" %*
  11. set /a errors=errors+1
  12. goto :EOF
  13. #!perl
  14. use strict;
  15. use lib $ENV{RAZZLETOOLPATH};
  16. use ParseArgs;
  17. use Logmsg;
  18. sub Usage { print<<USAGE; exit(1) }
  19. Prints the given string to the screen and into a file.
  20. Used by command scripts to log messages.
  21. usage: errmsg.cmd <message> [logfile]
  22. message Specifies the text to be logged, should
  23. be quoted
  24. logfile Specifies the name of the log file.
  25. LOGFILE, if defined, is the default.
  26. If this parameter is not specified and
  27. LOGFILE is not defined, the message is
  28. displayed on the screen only.
  29. The output message has the format:
  30. [yyyy/mm/dd-hh:mm:ss] (%SCRIPT_NAME%) : message
  31. ex: call errmsg.cmd "This is the message to display."
  32. USAGE
  33. my ($message, $logfile, $foo);
  34. parseargs('?' => \&Usage,
  35. \$message,
  36. \$logfile);
  37. if ($logfile) {
  38. $ENV{LOGFILE} = $logfile;
  39. }
  40. $ENV{SCRIPT_NAME} ||= '????';
  41. errmsg $message;