VBScript program to find the line in a specified text file that corresponds to a specified line number. This can be used to determine which line in a VBScript or PowerShell program raised an error.
Error messages displayed when VBScript or PowerShell programs are run indicate the line number of the statement that raised the error. Manually counting lines is time consuming and error prone. This program was developed to make this easier.
The program requires two parameters, the name of the file and the line number. The program reads the designated file, then displays the line immediately before the one specified, the specified line, and the line immediately after. The line numbers for these three lines is also displayed. This should help determine the line that corresponds to the line number. The syntax for the program would be similar to the following:
cscript //nologo FindLineNo.vbs Example.vbs 76
The resulting output could be similar to the following (note the missing quote character in line 76 that probably raised the error):
075: If (k > 0) Then
076: strValue = "Test
077: End If
FindLineNo.txt <<-- Click here to view or download the program