You??™ll also see how to use some of the objects described in the ???Using
the Scripting Objects??? section of the chapter. The following code shows a basic example in VBScript.
' Test1.VBS shows how to use functions and subprocedures
' within a WSH script.
WScript.Echo("The value returned was: " + CStr(MyFunction(1)))
function MyFunction(nSomeValue)
WScript.Echo("Function received value of: " + CStr(nSomeValue))
Call MySubprocedure(nSomeValue + 1)
MyFunction = nSomeValue + 1
end function
sub MySubprocedure(nSomeValue)
WScript.Echo("Subprocedure received value of: " + CStr(nSomeValue))
end sub
Newer Utilities Can Replace Older Equivalents
One of the tricks of the trade when working at the command line is to look for efficient replacements of
old bulky commands. The NetSH utility is such a replacement. You can use it in place of a number
of older utilities and graphical tools. For example, the NetSH utility replaces the older RouteMon utility.
Even though you??™ll find the RouteMon executable on Windows XP and newer systems, the executable
now tells you to use NetSH instead.
As part of keeping track of utility functionality, you must also monitor the services that Microsoft supports.
Pages:
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446