多谢,受你的启发,将脚本改为:#include <File.au3>
#include<array.au3>
Global $x
If $cmdline[0] = 1 Then
$x = $cmdline[1]
EndIf
$file2 = FileOpen(FileGetLongName($x), 0)
If $file2 = -1 Then
MsgBox(0, "错误", "不能打开文件.")
Exit
EndIf
$file2 = FileRead($file2)
FileClose($file2)
FileDelete(@ScriptDir & "\输出.txt")
$file3 = FileOpen(@ScriptDir & "\输出.txt", 2)
If $file3 = -1 Then
MsgBox(0, "错误", "不能打开输出文件.")
Exit
EndIf
Local $sText
$sReg = StringRegExp($file2, '\n(\d{2,4}\s+.+)', 3);
For $i = 0 To UBound($sReg) -1
$sText &= $sReg[$i]
MsgBox(0, '匹配结果', $sReg[$i])
Next
FileWrite($file3, $sText)
FileClose($file3)
为何还是执行不了呢? |