473,785 Members | 2,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to display a message in console window?

<package>
<job id="js">
<script language="JScri pt">
var WshNetwork = WScript.CreateO bject("WScript. Network");
var oDrives = WshNetwork.Enum NetworkDrives() ;
var oPrinters = WshNetwork.Enum PrinterConnecti ons();
WScript.Echo("D omain = " + WshNetwork.User Domain);
WScript.Echo("C omputer Name = " + WshNetwork.Comp uterName);
WScript.Echo("U ser Name = " + WshNetwork.User Name);
WScript.Echo();
WScript.Echo("N etwork drive mappings:");
for(i=0; i<oDrives.Count (); i+=2){
WScript.Echo("D rive " + oDrives.Item(i) + " = " +
oDrives.Item(i+ 1));
}
WScript.Echo();
WScript.Echo("N etwork printer mappings:");
for(i=0; i<oPrinters.Cou nt(); i+=2){
WScript.Echo("P ort " + 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 18598
thinktwice wrote:
<package>
<job id="js">
<script language="JScri pt"> <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
4464
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 this is done. The only thing I can think of is that there is hidden code to spawn cmd.exe? Then they somehow direct console.read and console.write calls to the spawned process. Any thoughts (and some sample code) would be greatly appreciated.
2
3081
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 (I have this code in my app: if (args.length ==0) FreeConsole() which causes the console to be closed) Is there a way to prevent this console window from appearing in the first place.
5
4772
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 boot loader for an OS, I came across code to clear the console. It works. However, I post it here to get opinions on using this. I have tested it in Windows but not yet on Linux (I am assuming that it will work the same as it calls the BIOS video...
11
4856
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. The problem is that ok is set to true, con is set to a number (all fine until here) the console window appears but the string "anthonyb" is never displayed there...
1
1507
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 is compiled as a windows project, I don't have the shell/dos window anymore, how can I get the previous output to be displayed in a listbox? I can see it from the output window of VS.NET but I want it from the application itself.
0
4708
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 message so that when the console window gets redrawn, I can repaint what I need to on this window. So far, no luck. First I install the hook by calling the SetWindowsHookEx passing the type WH_CALLWNDPROC, a delegate for the HOOKPROC param,...
1
7448
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 the project output type to a console application and I dont want to do that. It wouldnt work the way I want anyways. I just need a way to display text to the console window that the program was launched from.
10
6350
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 so that the window for the Console application is not visible. However, when using some of the 'advanced' properties of the StartInfo object, like Username, Password and Domain, the WindowsStyle property of the StartInfo object is ignored....
3
1383
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 there anyway to suppress the console window from showing? One of the options is I have is to generate the xml file without showing the console window. Even though I'm not calling the Console it still flashes. Any suggestions. I plan on running this...
0
10350
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10097
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9957
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7505
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.