Scripting Question to get first few records of text file to output to another text file RRS feed

  • Question

  • I have an existing script below and need to just get the first 2000 records off the "geo.txt" file.  Can someone help me with this?  Any help is greatly appreciated.

    Option Explicit

    Dim objFSO, objInFile, objOutFile, colFiles, objFolder, objFile

    Dim sCR, sTab, SLine, sArray

    Dim iCount, iCountF, iCountS, iDummy

    sCR = Chr(13)

    sTab = Chr(9)

    Const ForReading = 1

    Const ForWriting = 2

    Const ForAppending = 8

    Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")

    Set objInFile = objFSO.OpenTextFile("c:\desktop\geo.txt",ForReading)

    If objFSO.FileExists("c:\desktop\test.txt") Then


    End If

    Set objOutFile = objFSO.CreateTextFile("c:\desktop\test.txt")


    Set objOutFile = objFSO.OpenTextFile("c:\desktop\test.txt",ForWriting)

    Do Until objInFile.AtEndofStream

    SLine = objInFile.ReadLine





    • Moved by Bill_Stewart Friday, January 26, 2018 6:39 PM Unanswerable drive-by question
    Tuesday, December 26, 2017 11:41 PM

All replies

  • Sorry but we don't fix scripts on request.  Please ask the author of your script for help.

    I also recommend that you skip VBScript and use PowerShell.

    Get-Content c:\desktop\geo.txt -TotalCount 2000


    Wednesday, December 27, 2017 4:40 AM