Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 23: Using the Scripting Objects > Create a Basic Script

Create a Basic Script

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))


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial