Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

single echo window

Status
Not open for further replies.

jdeane

IS-IT--Management
Sep 21, 2001
229
GB
I have a lot of scripts from the MS scripting guys, below is an example of one of them, this script and everyother one from them always displays each result line in individual window.

My question, is there a way that I can adapt the script to display the results in a single window.

Thanks

Jon

----------

On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
("Select * from Win32_DisplayConfiguration")

For Each objItem in colItems
Wscript.Echo "Bits Per Pel: " & objItem.BitsPerPel
Wscript.Echo "Device Name: " & objItem.DeviceName
Wscript.Echo "Display Flags: " & objItem.DisplayFlags
Wscript.Echo "Display Frequency: " & objItem.DisplayFrequency
Wscript.Echo "Driver Version: " & objItem.DriverVersion
Wscript.Echo "Log Pixels: " & objItem.LogPixels
Wscript.Echo "Pels Height: " & objItem.PelsHeight
Wscript.Echo "Pels Width: " & objItem.PelsWidth
Wscript.Echo "Setting ID: " & objItem.SettingID
Wscript.Echo "Specification Version: " & objItem.SpecificationVersion
Wscript.Echo
Next
 
Launch the script with cscript instead of wscript.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
try this:
msg=""

lf = vbcrlf
For Each objItem in colItems
msg = msg & "Bits Per Pel: " & objItem.BitsPerPel &lf
msg = msg & "Device Name: " & objItem.DeviceName &lf
msg = msg &"Display Flags: " & objItem.DisplayFlags &lf
msg = msg & "Display Frequency: " & objItem.DisplayFrequency &lf
msg = msg &"Driver Version: " & objItem.DriverVersion &lf
msg = msg & "Log Pixels: " & objItem.LogPixels &lf
msg = msg & "Pels Height: " & objItem.PelsHeight &lf
msg = msg & "Pels Width: " & objItem.PelsWidth &lf
msg = msg & "Setting ID: " & objItem.SettingID &lf
msg = msg & "Specification Version: " & objItem.SpecificationVersion &lf

Next
wscript.echo msg
 
phv,
i tried cscript, i'm getting an error. can you show how to launch cscript?
the error i got was "object required: cscript
 
DON'T MODIFY YOUR SCRIPT !
Right click your VBS file and choose the alternate open method.
OR
Open a console windows and type something like this:
cscript "\path\to\yourscript.vbs"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
cool phv. that works fine in console window. but what about from windows desktop? would it work there?
 
thanks barny2006, that is exactly the output I was looking for, very easy for me now to add in the extra lines and replace the Wscript.Echo with 'msg = msg &' etc

Jon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top