Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

WScript.Echo Title

Posted on 2011-03-02
7
Medium Priority
?
3,329 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
6 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 71

Accepted Solution

by:
Qlemo earned 1000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

782 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