Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Scripts can make the command line significantly easier to automate and can improve the reliability of command line tasks by helping you perform tasks in the same sequence every time. This section shows how to create basic scripts in both VBScript and JavaScript so you can see the differences between the two languages. You’ll also see how to use some of the objects described in the scripting object-specific sections 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))