Moving Past Lame Arrays
I will admit the previous script was pretty lame. But because the construction of an array is very finicky, I wanted you to have a reference for the basic array (you will need it for your labs).
In the next script (ArrayReadTxtFile.vbs), you open up a text file, parse it line by line, and write the results into an array. You can use this line-parsing tactic later as a way to feed information into a more useful script. Right now, all you’re doing with the array after it is built is echoing its contents out to the screen.
Option Explicit On Error Resume Next Dim objFSO Dim objTextFile Dim arrServiceList Dim strNextLine Dim i Dim TxtFile Const ForReading = 1 TxtFile = "c\scripts\ServersAndServices.txt" Set objFSO = CreateObject("Scripting.FileSystemObject") ...
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.