楼主试一下这个非常规的方法!
$f = FileOpen(@ScriptDir & "\123.txt", 10)
For $i = 1 To 100000
If $i = 99958 Then
FileWriteLine($f, Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & "qw" & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)))
Else
FileWriteLine($f, Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)) & Chr(Random(48, 57, 1)))
EndIf
Next
FileClose($f)
$n = MsgBox(1, "", "10W文本生成完毕,现在开始计时" & @CRLF & "按确定开始")
If $n = 1 Then
$time = TimerInit()
$c = FileRead(@ScriptDir & "\123.txt")
$num = StringInStr($c, "qw")
$str = StringLeft($c, $num)
StringReplace($str, @CRLF, "")
$t = TimerDiff($time)
MsgBox(0, "", "qw所在的行是" & @extended + 1 & @CRLF & "所用时间:" & $t & "ms")
EndIf
|