Option Explicit Dim strPath 'As String Dim objTxStream 'As ADODB.Stream Dim lngLOF 'As Long Dim lngRnd 'As Long Dim strText 'As String Dim lngP1 'As Long Dim lngP2 'As Long Const adTypeText = 2 Randomize Timer strPath = "" If WScript.Arguments.Count > 0 Then strPath = WScript.Arguments(0) If strPath = "" Then strPath = "C:\PKG\Quote\" Set objTxStream = CreateObject("ADODB.Stream") objTxStream.Open objTxStream.Type = adTypeText ' = 2 objTxStream.Charset = "ASCII" objTxStream.LoadFromFile strPath & "QUOTES.DAT" lngLOF = objTxStream.Size lngRnd = Int(lngLOF * Rnd() + 1) 'WScript.Echo "Filepos:", lngRnd objTxStream.Position = lngRnd strText = objTxStream.ReadText(8192) lngP1 = InStr(strText, vbCrLf & "$") If lngP1 > 0 Then lngP2 = InStr(lngP1 + 1, strText, vbCrLf & "$") - lngP1 - 3 'WScript.Echo ">" & Mid(strText, lngP1 + 3, lngP2) & "<" WScript.Echo Mid(strText, lngP1 + 3, lngP2) Else WScript.Echo "No ""$"" found in:" WScript.Echo strText End If objTxStream.Close WScript.Quit