VBScript to read and write the data in a text file
kw.vbs
SetobjFSO=CreateObject("Scripting.FileSystemObject")filePath="D:\VBScript\Trial.txt"SetobjFile=objFSO.OpenTextFile(filePath,8)'8 for appending textobjFile.Write"I am "&vbCrLf&"Writing"objFile.CloseIfobjFSO.GetFile(filePath).Size>1ThenSetobjFile=objFSO.OpenTextFile(filePath,1)'1 for reading textDoUntilobjFile.AtEndOfStreamstrLine=objFile.ReadLineprintstrLineLoopobjFile.CloseElseprintobjFSO.GetFileName(filePath)&" File is Empty"EndIf
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.