WSH 5.7's shell.Run executes wrong Scripting Host engine?
I use a WSC (a COM server written in JScript and run with scrobj.dll) that starts also other script files using shell.Run("TheOtherScript.js");
The WSC server is instantiated with new ActiveXObject(PROGID). Until WSH 5.6 I could set the execution engine for shell.Run with the command
WScript //H:CS开发者_如何学运维cript
or with //H:WScript to get the engine I need. For interactive mode I need WScript that pops up a message box on WScript.Echo; for non-interactive mode that is prohibited, since it holds the execution.
After update to WSH 5.7 the WScript.Echo in TheOtherScript.js always causes a MessageBox, independend of the //H: parameter I passed before. This breaks all unattended script execution.
I think this is a bug in WSH 5.7, when can it be fixed, how can I build a workaround?
You need to change the server to control which scripting engine should be used. To avoid all clients to best way is to define an environment variable to control the selection.
shell.Run("cscript //E:??? TheOtherScript.js");
where ???
is the engine you want to use.
精彩评论