Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

WScript.Echo Title

Posted on 2011-03-02
7
2,828 Views
Last Modified: 2012-05-11
I have a bit of Visual Basic script that will echo the current computer name, IP address, and mac address. The only thing is by using the WScript.Echo is displays "Windows Script Host" as the title. I would like to change that title and am unsure if that can be done with WScript.Echo.

Code:

Set objShell = Wscript.CreateObject("Wscript.Shell")
Set colSystemEnvVars = objShell.Environment("System")
Set colUserEnvVars = objShell.Environment("User")
Set objNetwork = Wscript.CreateObject("Wscript.Network")

samUser = objNetwork.UserName
computerName = objNetwork.ComputerName


strComputer = "."
Set objWMIService = GetObject(_
    "winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
    ("Select * FROM Win32_NetworkAdapterConfiguration Where IPEnabled = True")
 
   For Each objItem In colItems
   strIPAddress = Join(objItem.IPAddress, ",")
        WScript.Echo "Computer: " & computerName & vbCr & _
      "IPAddress: " & strIPAddress & vbCr & _
      "MACAddress: " & objItem.MACAddress & vbCr & _
           ""
   Next

I know this is just being a bit picky but i was wondering if there was a way to do it.
Thanks in advance for your responses.
0
Comment
Question by:trineit
7 Comments
 
LVL 12

Expert Comment

by:prashanthd
ID: 35019578
wscript.echo does not have anything to do with the title "Windows Script Host", it is the version using which the script executes.

0
 
LVL 12

Expert Comment

by:prashanthd
ID: 35019598
wscript.echo does not have anything to do with the title "Windows Script Host", it is the version using which the script executes.

0
 
LVL 69

Accepted Solution

by:
Qlemo earned 250 total points
ID: 35019615
No. That popup is a "surrogate" to allow for simple echoing content. You now can
(a) run the script with cscript instead of wscript - that will then echo to the console, not a window.
(b) use a message box, filled yourself (see e.g. http://www.w3schools.com/vbscript/func_msgbox.asp).
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 12

Expert Comment

by:prashanthd
ID: 35019802
I got confused with the following which is displayed when using cscript, was thinking you were using cscript.

Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

Anyway please follow Olemo's suggestions, they are the possible solutions
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 35022491
No points for my comment, just clarifying what has already been said.

WScript.Echo is not configurable.  When a script is run using WScript.exe, it just echos to a plain message box, but if the script is run using CScript.exe, it echoes to the command prompt, and does not wait for any user interaction.

MsgBox is configurable (to some extent).  Whether a script is run using WScript.exe or CScript.exe, it behaves the same way, displaying a windows message box that must have user input to continue.

Qlemo has provided a link to it's syntax, but here's an example:
MsgBox "Your text", vbOKOnly, "Window Title"

Regards,

Rob.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35859678
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB Script: Correction backup files and folders v3 11 28
Multiflying 2 Input Text On a Table 7 31
VMWare Calculate number of processors 10 64
Diminish Pop-up  in 3 seconds 7 48
Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question