Using Multiple Arguments

In pingMultipleComputers.vbs, you use only one argument, which you assigned to the variable strMachines by using this command:

strMachines = WScript.Arguments.Item(0)

When you look at the command, you see that it’s made up of several parts:

Variable

=

WScript.Arguments.Item

Item #

strMachines

=

WScript.Arguments.Item

(0)

If you need to use multiple arguments or multiple items (whichever term you prefer), you simply add another line and increment the item number contained within the parentheses.

Get Microsoft® Windows® Scripting Self-Paced Learning Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.