0
다음 코드를 사용하여 텍스트 파일을 두 개의 파일로 분할했습니다. 원본 파일은 20 개의 파일로 나뉘어져 있으며 2 개의 파일로 나뉘어 있습니다. 스크립트가 실행되고 프로세스가 완료되면 출력 위치에서 분할 된 파일을 볼 수 없다는 메시지가 맨 끝에 표시됩니다. 코드에서 문제가 무엇인지 말해 주시고, vbscript에 익숙하지 않으므로 제발 도와주세요.vbscript에서 텍스트 파일을 분할 할 때 출력이 나타나지 않습니다.
Dim Counter
Const InputFile = "C:\Cs.txt"
Const OutputFile = "C:\Users\rmehta\Desktop"
Const RecordSize = 10
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile (InputFile, ForReading)
Counter = 0
FileCounter = 0
Set objOutTextFile = Nothing
Do Until objTextFile.AtEndOfStream
if Counter = 0 Or Counter = RecordSize Then
Counter = 0
FileCounter = FileCounter + 1
if Not objOutTextFile is Nothing then objOutTextFile.Close
Set objOutTextFile = objFSO.OpenTextFile(OutputFile & "_" & FileCounter & ".txt", ForWriting, True)
end if
strNextLine = objTextFile.Readline
objOutTextFile.WriteLine(strNextLine)
Counter = Counter + 1
Loop
objTextFile.Close
objOutTextFile.Close
Msgbox "Split process complete"
cnSize = 11로 유지하는 작은 변화와 함께 ... 고마워요 !!! 매우 유용 :) – M3HTA
도와주세요. http://stackoverflow.com/q/18722318/2636830 – M3HTA
미리 감사드립니다. :) – M3HTA