やあみんな私は私のvbsスクリプトに問題があります。私のスクリプトはテキストファイルを開き、それを読み取り、いくつかのエントリを削除します。ソースファイルの最終行が宛先ファイルに約30回書き込まれるため、スクリプトのどこかにエラーがあるはずです。コードにエラーが見つかりません。誰かが見ているかもしれません。はい、大きなコード部分を投稿するべきではないことを知っています。私のコードは次のとおりです。
separator = " "
x = 0
strRawPath = "C:\xampp_neu\xampp\htdocs\tc_backup\stasknoheader.txt"
strRawPathW = "C:\xampp_neu\xampp\htdocs\tc_backup\stask.txt"
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
Set fsw = CreateObject("Scripting.FileSystemObject")
' 2 = ForWriting
Set f = fs.OpenTextFile(strRawPath,1)
Set w = fsw.OpenTextFile(strRawPathW,2)
Do While f.AtEndOfStream <> True
x = x+1
'Anlegen des Arrays
ReDim Preserve myArray(x)
strLine = f.Readline
'Speichern in Array
myArray(x) = strLine
'Loop so that lines that contains Microsoft or TaskName are not written
If InStr(strLine, "Microsoft") = 0 Then
If InStr(strLine, "TaskName") = 0 Then
If InStr(strLine, "Restart System") = 0 Then
If InStr(strLine, "Scheduler-HSM-mig-TC11TDrive") = 0 Then
strNewLine = strNewLine & strLine & vbCrLf
'Replace blank with " AM, "
strNewLine =(Replace(strLine," ",separator,1,2))
'Removes \ from TaskName
strNewLine =(Replace(strNewLine,"\","",1,1))
'WScript.Echo strNewLine
End If
End If
End If
End If
w.write strNewLine & VbCrLf
'WScript.Echo strNewLine
Loop
f.Close
w.Close