473,395 Members | 1,521 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to display a message in console window?

<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

Jan 18 '06 #1
5 18575
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.
Jan 18 '06 #2
i call it in bat file,
like this :
cmd CScript /k C:\test.wsf

Jan 18 '06 #3
I'm kinda intermediate with Javascript, what is this type of syntax
referencing to?

Jan 18 '06 #4
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.
Jan 21 '06 #5
thanks Richard, it works

Jan 25 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jason Callas | last post by:
I am trying to figure out how to create a console window but cannot figure out how to do this. I know it can be done since the C# and VB console template projects do this but I see no code on how...
2
by: Ram | last post by:
I have a console application that brings up a dialog if invoked with no command line parameters. If I double click on my application a console window is briefly displayed before the dialog appears...
5
by: phickman | last post by:
Hi all. After several searches using Google, I had just about given up on finding a way to clear the console Window. After spending the past week learning assembly language and writing a small...
11
by: objectref | last post by:
Hi to all, i have a window app and i want to display some info in a console window. I figured out (after a very long search...) how am i supposed to do it and i try using the following code. ...
1
by: Marty | last post by:
Hi, I have a DLL that display message in the Console window. My program was previously compiled as a console project and the output was readable from the shell/dos window. Now that my project...
0
by: Mythran | last post by:
I can draw onto the console window where I want using a mixture of API calls and the System.Drawing namespace (.Net 1.1). I am trying to install hooks for the window to catch a resize or another...
1
by: Josh | last post by:
Iv created a program that has many command-line arguments. I want to beable to display help information in the console window that the person typed the command into. I cant do this unless I switch...
10
by: Stephany Young | last post by:
When one uses the System.Diagnostics.Process.Start method to launch a common or garden Console application, one can set the WindowStyle property of the StartInfo object to ProcessWindowStyle.Hidden...
3
by: =?Utf-8?B?VGVycmFuY2U=?= | last post by:
Good Afternoon: I have two questions I was hoping someone can help me with. 1. I've created a app that creates a xml file; the project was constructed as a console window. I want to know is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.