Home XP WSH

WshScript.Echo

Echo a text string to the screen (cscript) or a dialogue box (wscript)

Syntax 
      WScript.Echo [Arg1] [,Arg2] [,Arg3] ... 

Arguments:
         Arg1, Arg2, Arg3 ... Optional string values to be displayed.
                              If no arguments are provided a 
                              blank line is output.
Examples
  WScript.Echo "Hello"
  WScript.Echo

  Set objNet = WScript.CreateObject("WScript.Network")
  WScript.Echo "Your Computer Name is " & objNet.ComputerName
  WScript.Echo "Your Username is " & objNet.UserName

An alternative is to use Active Directory:

  Set objAD = CreateObject("ADSystemInfo")
Wscript.Echo "Your Computer Name is " & objAD.ComputerName
Wscript.Echo "Your Username is " & objAD.UserName ECHO can be suppressed by setting .Interactive to false e.g. WScript.Echo("Hello") WScript.Interactive = false WScript.Echo("This wont display") WScript.Interactive = true WScript.Echo("This will display")

"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo Inc, 1989

Related commands:

Echo, popup - WshShell.Popup

Equivalent Windows command:

ECHO - Display message on screen



Back to the Top

Simon Sheppard
SS64.com