LEcho.exe

The LEcho utility displays and writes messages to log files and sets the system error level.

The LEcho utility performs the following functions:

ServerGuide Scripting Toolkit provides 32- and 64-bit versions of LEcho.

For LEcho.exe to write a message to a log file, you must set the environment variable LECHO_LOG to a fully qualified path and file name by using a command similar to the following:
set LECHO_LOG=C:\SGTKWinPE\Lecholog.txt
LEcho checks the number of characters on the command line against the current command line limits of 8000 characters for the Windows environment. A message is displayed if the characters exceed the limit.

Usage

The LEcho utility has the following command-line syntax:
LEcho [message] [/F] [/R:n] 
[/E:n] [/P] [/P:n] [/T:n] 
[/SC] [/SN] [/N] [/LO] [/DO] [/?]
Table 1. LEcho parameters
Parameter Description
message The message to display to the screen or log file.
/F Formats the message using the following variables:
  • %d or %nd formats the system date. The format is indicated by n:
    • 0 = Sun 12/31/2006 (Default)
    • 1 = Sunday, December 31, 2006
    • 2 = Sun, Dec 31, 2006
    • 3 = Dec 31, 2006
    • 4 = 12-31-2006
    • 5 = 12/31/2006
    • 6 = 2006-12-31
    • 7 = 2006-Dec-31
    • 8 = 2006-December-31
    • 9 = 20061231
  • %t or %nt formats the system time. The format is indicated by n.
    • 0 = 16:12:13 (Default)
    • 1 = 04:12:13 PM
  • \a sets an alert (bell)
  • \b - backspace
  • \f - form feed
  • \n - newline
  • \r - carriage return
  • \t - horizontal tab
/R:n Repeats the message n times.
/E:n Displays the error message and sets the system error level to n.
/P Pauses until a key is pressed.
/P:n Pauses for n seconds or until a key is pressed
/T:n Initiates a timer for n seconds. This timer cannot be ended prematurely.
/SC Suppresses the output of the countdown timer.
/SN Suppresses the newline character.
/N Creates a new, blank log file. If the log file already exists, it is overwritten.
/LO Writes the message to the log file only.
/DO Writes the message only to the display.
/? Displays a help message containing the application syntax.

LEcho return codes

The LEcho utility returns the following values to indicate status:
  • 0 - Success or true.
  • 1 - Syntax error.
  • 5 - Cannot write to log file.
  • 100 - False.
  • 255 - Program error.

LEcho examples

The following examples illustrate how to use the LEcho utility.
Example Description
LEcho Sends a blank line to the display and the log file if LECHO_LOG is set.
LEcho My Message Sends the text My Message to the display and to the log file if LECHO_LOG is set.
LEcho /T Displays a message indicating the current system time to the display and to the log file if LECHO_LOG is set.
LEcho My Message /T Sends the text 13:55:24 My Message to the display and the log file if LECHO_LOG is set. 13:55:24 indicates the current system time.
LEcho My Message /T /DO Sends the text 13:55:24 My Message to the display only. 13:55:24 indicates the current system time.
LEcho My Message /E:200 Sends the text My Message to the display and the log file if LECHO_LOG is set and then sets the system error level to 200.
LEcho /E:155 Sets the system error level to 155. No text is displayed or logged.
LEcho New Log File /N /LO
  • Creates a new log file from LECHO_LOG.
  • If a log file already exists, it is deleted and a new one is created.
  • Sends the text New Log File to the new log file only; no text is displayed to the screen.
LEcho %d\t%t My Message /F Sends the text Sun 12-31-2006 16:12:13 My Message to the screen and log file if LECHO_LOG is set.
LEcho Pausing for 30 seconds. /P:30 Sends the text Pausing for 30 seconds and starts a countdown timer at 30. You can bypass the countdown by pressing any key.
LEcho Running a 30 second timer. /T:30 /SC /SO Sends the text Running a 30 second timer. to the screen only and returns control to the environment after 30 seconds. No timer is displayed.