Home All Groups Group Topic Archive Search About

How to print to command prompt instead of pop-up window



Author
29 Oct 2007 5:07 AM
Afsal
Hi all,

     Can any one help me with the below code. I want the output to be
printed to the command prompt instead of poping up in a window.

====================================
dsRoot = "WinNT://RAC_MASTER/MUNAWAA"
set wshShell = Wscript.CreateObject("Wscript.Shell")
set dsObj = GetObject(dsRoot)
For Each Prop In dsobj.groups
    wshshell.popup Prop.Name
Next 'Prop
========================================

Author
29 Oct 2007 12:25 PM
Richard Mueller [MVP]
Show quote
"Afsal" <afsal@AVIVA> wrote in message
news:0F09EF87-BAF2-4AB8-A25A-B961AF5D18C7@microsoft.com...
> Hi all,
>
>     Can any one help me with the below code. I want the output to be
> printed to the command prompt instead of poping up in a window.
>
> ====================================
> dsRoot = "WinNT://RAC_MASTER/MUNAWAA"
> set wshShell = Wscript.CreateObject("Wscript.Shell")
> set dsObj = GetObject(dsRoot)
> For Each Prop In dsobj.groups
>    wshshell.popup Prop.Name
> Next 'Prop
> ========================================
>
>

Replace "wshshell.popup" with "Wscript.Echo" (No need for Wscript.Shell
object). For example:
==========
dsRoot = "WinNT://RAC_MASTER/MUNAWAA"
set dsObj = GetObject(dsRoot)
For Each Prop In dsobj.groups
    Wscript.Echo Prop.Name
Next
=========

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
Author
29 Oct 2007 12:40 PM
Tom Lavedas
On Oct 29, 1:07 am, Afsal <afsal@AVIVA> wrote:
> Hi all,
>
>      Can any one help me with the below code. I want the output to be
> printed to the command prompt instead of poping up in a window.
>
> ====================================
> dsRoot = "WinNT://RAC_MASTER/MUNAWAA"
> set wshShell = Wscript.CreateObject("Wscript.Shell")
> set dsObj = GetObject(dsRoot)
> For Each Prop In dsobj.groups
>     wshshell.popup Prop.Name
> Next 'Prop
> ========================================

Assuming you are running the script from the command prompt, using the
cscript.exe host, siply replace wshshell.popup with wscript.echo (you
will no longer need to instantiate the wshshell object for this
purpose, but it will cause no harm).

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
Author
30 Oct 2007 12:24 PM
Afsal
Thank you friends, its working.

AddThis Social Bookmark Button