WSCRIPT.ECHO commands seem to fail in VBScript Tasks

Article:TECH140223  |  Created: 2010-09-17  |  Updated: 2010-09-17  |  Article URL http://www.symantec.com/docs/TECH140223
Article Type
Technical Solution


Environment

Issue



If we put a wscript.echo "hi" command into a Task for VBScript, it doesn't pop up a message box.


Error



No error is generated.   It simply doesn't run.


Cause



This is actually working as designed.  When we execute VBScripts from the Altiris Agent, we launch a command window and launch the script via CScript (not WScript).  CScript interprets the WScript.Echo command as a normal echo command and echos to the current environment - that is the command window.  Since it has already echo'd to the command window, and since there is no "OK" button, the script execution continues and the command window is closed before you ever see the message.

WScript and CScript are both supported methods of executing VBS, but in this case, the expected results differ from the actual results.  Echo is designed to be different than MSGBox.   It just so happens that if you're in a Windows only version of the WSH, Echo has to echo to a Window, and thus the box is popped up.


Solution



The resolution is to call a message box directly using msgbox "hi" instead of wscript.echo.  The result with msgbox will be exactly what is desired.



Article URL http://www.symantec.com/docs/TECH140223


Terms of use for this information are found in Legal Notices