Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > how to display a message in console window?

Reply
Thread Tools

how to display a message in console window?

 
 
thinktwice
Guest
Posts: n/a
 
      01-18-2006
<package>
<job id="js">
<script language="JScript">
var WshNetwork = WScript.CreateObject("WScript.Network");
var oDrives = WshNetwork.EnumNetworkDrives();
var oPrinters = WshNetwork.EnumPrinterConnections();
WScript.Echo("Domain = " + WshNetwork.UserDomain);
WScript.Echo("Computer Name = " + WshNetwork.ComputerName);
WScript.Echo("User Name = " + WshNetwork.UserName);
WScript.Echo();
WScript.Echo("Network drive mappings:");
for(i=0; i<oDrives.Count(); i+=2){
WScript.Echo("Drive " + oDrives.Item(i) + " = " +
oDrives.Item(i+1));
}
WScript.Echo();
WScript.Echo("Network printer mappings:");
for(i=0; i<oPrinters.Count(); i+=2){
WScript.Echo("Port " + oPrinters.Item(i) + " = " +
oPrinters.Item(i+1));
}
</script>
</job>
</package>

find an example in msdn, but it displays the message in messagebox not
in console window

 
Reply With Quote
 
 
 
 
Richard Cornford
Guest
Posts: n/a
 
      01-18-2006
thinktwice wrote:
> <package>
> <job id="js">
> <script language="JScript">

<snip>
> </script>
> </job>
> </package>
>
> find an example in msdn, but it displays the message in
> messagebox not in console window


Are you running it with WScript.exe or CScript.exe? CScript.exe should
echo to the console window.

Richard.


 
Reply With Quote
 
 
 
 
thinktwice
Guest
Posts: n/a
 
      01-18-2006
i call it in bat file,
like this :
cmd CScript /k C:\test.wsf

 
Reply With Quote
 
DoomedLung
Guest
Posts: n/a
 
      01-18-2006
I'm kinda intermediate with Javascript, what is this type of syntax
referencing to?

 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      01-21-2006
thinktwice wrote:
> i call it in bat file,
> like this :
> cmd CScript /k C:\test.wsf


The - cmd - command starts another instance of the command interpreter
process, but it does not open a console window for that process. If it
did open a new console window then it would be to that window that echo
would write, but as there is no console window popping up message boxes
is probably what Microsoft see as the best alternative (especially given
that CScript has a switch to turn off message output for batch file
use).

If you execute:-

CScript C:\test.wsf

- in a batch file (or literally in the console window) echo does write
to that window.

Richard.


 
Reply With Quote
 
thinktwice
Guest
Posts: n/a
 
      01-25-2006
thanks Richard, it works

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Preventing the console window from closing when writing a console program in C++ Miktor C++ 7 08-09-2005 09:22 PM
Re: console mp3->wav decoder for $indows or GUI one which supports console Serge Terekhoff Python 0 06-30-2003 12:36 PM
Re: console mp3->wav decoder for $indows or GUI one which supports console Egor Bolonev Python 0 06-30-2003 10:43 AM
Re: console mp3->wav decoder for $indows or GUI one which supports console Ben Finney Python 2 06-30-2003 05:43 AM



Advertisments