VbscriptSample

On Error Resume Next


strComputer = "."
Const Quote = """"
Dim Result


' Store the arguments in a variable:
Set Args = Wscript.Arguments

Result = 0

'check usage
If 2 <> Args.Count Then
	Wscript.Quit 1
End If


If 2 = Args.Count Then
	Dim FilePath, strLine,stringToFind, strIndex, strTemp
	FilePath = Args(0)
	StringToFind = Args(1)
	Set objFSO=CreateObject("Scripting.FileSystemObject")
	if Not objFSO.FileExists(FilePath) Then
		WScript.Echo StringToFind
		WScript.Echo "FileReadError!"
		Wscript.Quit 1
	Else		
		Set objFile = objFSO.OpenTextFile(FilePath)	

		Do Until objFile.AtEndOfStream
			strLine = objFile.ReadLine
			'WScript.Echo strLine
			strIndex = InStr(1, strLine, StringToFind,1) 
			If strIndex = 1  Then				
				strTemp=Replace(strLine," ","",Len(StringToFind)+1)
				WScript.Echo StringToFind&"#"&strTemp									
			End If
		Loop
		objFile.Close
	End If

End If
Wscript.Quit Result