將某個腳本的一系列運(yùn)行時參數(shù)組合起來。
<runtime> <named attributes etc. /> <unnamed attributes etc. /> <example>Example Text</example> ? </runtime>
ShowUsage 方法使用由 <runtime> 元素括起來的信息,以便顯示腳本的運(yùn)行時參數(shù)。
由于 <runtime> 元素括在一對 job 標(biāo)記中,因此所定義的運(yùn)行時參數(shù)只適用于該作業(yè)。
注意 使用 5.6 版,<runtime> 元素中所括的數(shù)據(jù)只用于自我說明,以及為 ShowUsage 所顯示的數(shù)據(jù)設(shè)置格式。<runtime> 元素不對它所包含的參數(shù)強(qiáng)制實(shí)施值集合(即命令行中丟失“必需的”參數(shù)不會導(dǎo)致錯誤)。如果 <runtime> 元素包括在 .wsf 文件中,則用 "/?" 參數(shù)運(yùn)行腳本將會顯示用法并退出。
下面的腳本將演示 <runtime> 元素的用法:
<job> <runtime> <named name="server" helpstring="The server to run the script on" type="string" required="true" /> </runtime> <script language="JScript"> if (!WScript.Arguments.Named.Exists("server")) { WScript.Arguments.ShowUsage(); } // ... 此處是一些腳本 </script> </job>
ShowUsage 方法 | <named> 元素 | <unnamed> 元素 | <description> 元素 | <example> 元素