magiclx
magiclx

Reputation: 11

Why this XML script show message only once?

This code is from Microsoft script56.chm. Why does it show message only once?

I'm learning Windows Script Host and running xml.wsf in Windows command line.

<package>
    <job id="DoneInVBS">
    <?job debug="true"?>
        <script language="VBScript">
            WScript.Echo "This is VBScript"
        </script>
    </job>

    <job id="DoneInJS">
    <?job debug="true"?>
        <script language="JScript">
            WScript.Echo("This is JScript"); 
        </script>
    </job>
</package>

I expect it shows two messages.

Upvotes: 1

Views: 79

Answers (1)

user692942
user692942

Reputation: 16681

As I mentioned in the comments, you need to specify both Jobs during execution or it will run the first one in the file, in this case DoneInVBS.

The documentation for Job element is very clear (see script56.chm)

To run the second job in the Windows Script file, myScript.wsf, type the following at the command prompt.

cscript myScript.wsf //job:DoneInJS

To run both jobs in myScript.wsf, type the following at the command prompt.

cscript myScript.wsf //job:DoneInVBS //job:DoneInJS

Upvotes: 0

Related Questions