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

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

   Arg1, Arg2, Arg3...  Optional string values to be displayed.

If no arguments are provided a blank line is output.
Echo is a wscript method.


  WScript.Echo "Hello"

  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
  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 VBScript commands

Echo, popup - .Popup
Echo text to screen or file - StdOut.Write
Equivalent Windows CMD command: ECHO - Display message on screen.
Equivalent PowerShell cmdlet: Write-Host

Copyright © 1999-2024 SS64.com
Some rights reserved