HarvMan
IS-IT--Management
- Feb 11, 2004
- 13
Hi,
Trying to run a vbscript (below) using this command:
c:\windows\system32\cscript.exe bwqm.vbs
The purpose of the script is to read a text file and remove the first 4 characters in each line. However, the script is only processing the first record in the text file.
How to correct this? Thanks!
Code:
Const ForReading = 1
Const ForWriting = 2
Set objFSo = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\BWQMTest.txt", ForReading)
strContents = objFile.ReadAll
objFile.Close
intlength = Len(strContents)
strRemainder = Right(strContents, intLength - 4)
strNewContents = strRemainder
Set objFile = objFSO.OpenTextFile("C:\BWQMTest.txt", ForWriting)
objFile.WriteLine strNewContents
objFile.Close
Trying to run a vbscript (below) using this command:
c:\windows\system32\cscript.exe bwqm.vbs
The purpose of the script is to read a text file and remove the first 4 characters in each line. However, the script is only processing the first record in the text file.
How to correct this? Thanks!
Code:
Const ForReading = 1
Const ForWriting = 2
Set objFSo = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\BWQMTest.txt", ForReading)
strContents = objFile.ReadAll
objFile.Close
intlength = Len(strContents)
strRemainder = Right(strContents, intLength - 4)
strNewContents = strRemainder
Set objFile = objFSO.OpenTextFile("C:\BWQMTest.txt", ForWriting)
objFile.WriteLine strNewContents
objFile.Close