vbScript从特定行读取文件

vbScript从特定行读取文件,vbscript,readfile,hp-uft,Vbscript,Readfile,Hp Uft,大家好,我有一个疑问,关于如何读取从特定行开始的.txt文件,我从我想开始读取的行号中得到了行号,我正在尝试读取它,但总是从第一行开始 需要几分钟才能到达我需要的线路 这是我的密码 'Call F_CMN_GRL_FindObjects(17,15) strProperty = F_CMN_GRL_GlobalMain(6,17,15,0,"all items" ) strLine = split(strProperty,",") Print strLine(0) strValor

大家好,我有一个疑问,关于如何读取从特定行开始的.txt文件,我从我想开始读取的行号中得到了行号,我正在尝试读取它,但总是从第一行开始

需要几分钟才能到达我需要的线路

这是我的密码

'Call F_CMN_GRL_FindObjects(17,15)

strProperty = F_CMN_GRL_GlobalMain(6,17,15,0,"all items" )

strLine = split(strProperty,",")
    Print strLine(0)
strValor = split(strLine(0)," ") 
    Print strValue(1)

numberLine = strValue(1)
Call readFromLine(numberLine)
Function readFromLine(numberLine)

    numberLineEnd =numberLine + 7
    print numberLine
    print numberLineEnd
'   Option Explicit

    Dim oFso : Set oFso = CreateObject("Scripting.FileSystemObject")
    Dim oFile : Set oFile = oFso.OpenTextFile("C:\myFile.txt", 1)
'   Dim myArray()
'   ReDim myArray(0)

    'numberLine it's the number line from I want to start to read and I want to read until numberLineEnd            
    For i = numberLine to numberLineEnd step 1
        strLine = oFile.ReadLine

        print strLine
    Next
        'i = i + 1
        'numberLine = numberLine + 1
End Function 

我通过这样做解决了这个问题:

Dim i 
    Do While (i <= numeroLineaFin)
        If (i => numeroLinea) and (i<=numeroLineaFin) Then
'           If i <= numeroLineaFin Then
'               tmpstr = tmpstr & oFile.readline & VbCrLf
                tmpstr = oFile.readline
                print tmpstr
'           else
'            oFile.SkipLine
'           End If
        else
            oFile.SkipLine
        end if
        i = i + 1
    Loop
Dim i

执行While(i numeriolinea)和(i)注意
SkipLine
方法;将i=1的
应用于numberLine-1
文件有多大?如果文件相对较小,则可以通过在换行符处拆分文件,将其存储在数组中,然后使用arrayindex读取所需的行@约瑟夫兹你说得对,如果我不打-,它会跳到下一行我想去的地方start@PankajJaju我尝试过这个选项,但当我的文件有2500行或更多行时,这不是最有说服力的方式。@Lou:不要把答案放在问题中,即使是建议的编辑也不行。这就是答案帖的用途。