作家
登录

同文件夹内文本搜索器(vbs)

作者: 来源:www.28hudong.com 2013-03-30 08:56:22 阅读 我要评论

<HTML><HEAD><TITLE>同文件夹内文本搜索器(vbs)</TITLE> <META http-equiv=Content-Type content="text/html; charset=gb2312"> <SCRIPT language=vbscript id=clientEventHandlersVBS> <!-- Dim fso, f, f1, fc,fn,s,uf1,ufn Sub B1_onclick fn=T1.value '' pn=mid(location.pathname,2,len(location.pathname)-14) ShowFolderList(pn) End Sub Function ShowFolderList(path) ''msgbox path Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder(path) Set fc = f.Files '' ufn=ucase(fn) For Each f1 in fc filespec= path & f1.name ReadEntireFile(filespec) '' uf1=ucase(f1.name) '' if instr(uf1,ufn) <> 0 then '' s=s & "<a href=" & path & f1.name & ">" & f1.name & "</a><br>" '' end if Next document.write "已搜索到以下条目,请单击之。[墨伯编制 于2003年元月]<br>" document.write s set fc=nothing set f=nothing set fso=nothing End Function Function ReadEntireFile(filespec) Const ForReading = 1 Dim fso, theFile, retstring Set fso = CreateObject("Scripting.FileSystemObject") Set theFile = fso.OpenTextFile(filespec, ForReading, False) ufn=ucase(fn) Do While theFile.AtEndOfStream<> True retstring = theFile.ReadLine uf1=ucase(retstring) if instr(uf1,ufn) <> 0 then s=s & "<a href=" & path & f1.name & ">" & f1.name & "</a><br>" exit do end if Loop theFile.Close ReadEntireFile = s End Function --> </SCRIPT> </HEAD> <BODY> <P align=center><FONT color=#000000 size=6>请输入要搜索[在正文中包含]的关键词(</FONT><FONT color=#000000 size=3>忽略大小写</FONT><FONT color=#000000 size=6>)</FONT> </P> <P align=center><FONT size=2><FONT color=#000000>[墨伯编制 于2003年1月5日]</FONT> </FONT> </P> <P align=center><INPUT name=T1><INPUT type=button value=搜索! name=B1></P> <P align=center> </P></BODY></HTML>

  推荐阅读

  使用FSO把文本信息导入数据库

在开发WEB应用程序中,我们经常需要对文件系统中的驱动器、文件夹和文件进行处理,比如收集驱动器的相关信息;创建、添加、移动或删除文件夹和文件等。在VB6中新提供了一套称为FSO(File System Object)对象模型来>>>详细阅读


本文标题:同文件夹内文本搜索器(vbs)

地址:http://www.17bianji.com/kaifa2/ASP/33008.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)