Reading a CSV file using VBScript

后端 未结 2 1949
日久生厌
日久生厌 2020-12-11 10:35

I have a file with 4 fields.

A,B,C,D

I want to only extract the 4th Field and change it to \"E\"

Is there anyway to accomplish this

2条回答
  •  时光说笑
    2020-12-11 10:57

    Maybe a simple Replace would work.

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("c:\data.txt")
    strSearchString = objFile.ReadAll
    objFile.Close
    
    strSearchString = Replace(strSearchString,"A,B,C,D","A,B,C,E")
    
    Set objFile = objFSO.OpenTextFile("c:\data.txt",2)
    objFile.Write strSearchString
    objFile.Close
    

提交回复
热议问题