写一个VBS脚本,运行后,可以把此脚本里包含的一段文字提取出来 以text文件打开显示到当前。谢谢了
1个回答
展开全部
Dim fso
Dim str
str = "我爱你" '这里定义你要找的字符串
Set fso = WScript.CreateObject("Scripting.Filesystemobject")
Set read = fso.OpenTextFile("d:\workNote.txt",1)'其内路径是你要从哪里找的那个文本
temp = read.ReadAll
If InStr(temp, str)>0 Then
WScript.Echo "find"
Set output = fso.CreateTextFile("d:\workNote1.txt",True) '这个路径是你想要把你搜的字符串写到哪
output.Write str
WScript.Echo "写成功,保存完毕!"
output.Close
Else
MsgBox "not found"
End If
Set fso = nothing
Dim str
str = "我爱你" '这里定义你要找的字符串
Set fso = WScript.CreateObject("Scripting.Filesystemobject")
Set read = fso.OpenTextFile("d:\workNote.txt",1)'其内路径是你要从哪里找的那个文本
temp = read.ReadAll
If InStr(temp, str)>0 Then
WScript.Echo "find"
Set output = fso.CreateTextFile("d:\workNote1.txt",True) '这个路径是你想要把你搜的字符串写到哪
output.Write str
WScript.Echo "写成功,保存完毕!"
output.Close
Else
MsgBox "not found"
End If
Set fso = nothing
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询