TechTutorials - Free Computer Tutorials  







Where is the pop up? - Wscript and Cscript 
 


Added: 11/22/2005, Hits: 4,077, Rating: 0, Comments: 0, Votes: 0
Add To Favorites | Comment on this article
I write a fair bit of VBScripts to automate various tasks on a daily basis. Today I came across a strange anomaly with some very simple and basic code.

When writing any script I always use wscript.echo - quite often just to verify the output of the last command is as I expected.

So the wscript.echo works as I expect it on my Windows XP SP2 machine - it gives me the out put in a pop-up window. However, when I ran a script on my Windows 2003 server today (I am sure I have done this before without any issue) it displayed the output in the command console - which of course disappears before you can read it!

Strange!

The reason it turns out is to do with the default script host of the computer. It can be either wscript or cscript, which is a command line version of the script host. By running

Code :

wscript.exe //H:wscript


from the command line it changed my servers default script host from cscript to wscript. Now when I run wscript.echo from a VBScript it does produce the output in a pop-up box....





Comments (0)

Be the first to comment on this article


Related Items








7 Seconds Resources, Inc.




IT Showcase