神剑山庄资源网 Design By www.hcban.com
'把网上的一个小程序改得方便了点,这个搜索次效率很好。
复制代码 代码如下:
on error resume next
Dim keyWord, DirTotal, TimeSpend, FileTotal, Fso, outFile, txtResult, txtPath, sPath
Const MY_COMPUTER = &H11&
Const WINDOW_HANDLE = 0
Const OPTIONS = 0
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(My_Computer)
Set objFolderItem = objFolder.Self
strPath = objFolderItem.Path
Set objFolder = objShell.BrowseForFolder(WINDOW_HANDLE, "选择你要搜索的文件夹:", OPTIONS, strPath)
If objFolder Is Nothing Then
msgbox "您没有选择任何有效目录!"
wscript.quit
else
Set objFolderItem = objFolder.Self
sPath = objFolderItem.Path
txtpath=sPath
Set Fso = wscript.CreateObject("scripting.filesystemobject")
FileTotal = 0
DirTotal = 0
'sPath = left(Wscript.ScriptFullName,len(Wscript.ScriptFullName)-len(Wscript.ScriptName))
'txtPath = trim(inputbox("你选的目录是"&sPath,"文件搜索",sPath))
keyWord = LCase(inputbox("请输入搜索关键字点Cancel的话会得到目录列表:","文件搜索","mp3"))
set outFile = Fso.createtextfile(sPath & "\SearchResult.txt")
outFile.writeline "开始搜索..."
outFile.writeline "起启目录:" & txtPath
TimeSpend = Timer
myFind txtPath
TimeSpend = round(Timer - TimeSpend,2)
txtResult = "搜索完成!" & vbCrLf & "共找到文件:" & FileTotal & "个." & vbCrLf & "共搜索目录:" & DirTotal & "个." & vbCrLf & "用时:" & TimeSpend & "秒."
outFile.write txtResult
msgbox txtResult &"结果保存在"&sPath &"\SearchResult.txt"
outFile.close
set outFile = nothing
set Fso = nothing
Sub myFind(ByVal thePath)
Dim fso, myFolder, myFile, curFolder
Set fso = wscript.CreateObject("scripting.filesystemobject")
Set curFolders = fso.getfolder(thePath)
DirTotal = DirTotal + 1
If curFolders.Files.Count > 0 Then
For Each myFile In curFolders.Files
If InStr(1, LCase(myFile.Name), keyWord) > 0 Then
outFile.WriteLine FormatPath(thePath) & "\" & myFile.Name
FileTotal = FileTotal + 1
End If
Next
End If
If curFolders.subfolders.Count > 0 Then
For Each myFolder In curFolders.subfolders
myFind FormatPath(thePath) & "\" & myFolder.Name
Next
End If
End Sub
Function FormatPath(ByVal thePath)
thePath = Trim(thePath)
FormatPath = thePath
If Right(thePath, 1) = "\" Then FormatPath = Mid(thePath, 1, Len(thePath) - 1)
End Function
End if
=======================================================================
附件:关于打开目录的方面:
Private Const CSIDL_DESKTOP = &H0 ' <desktop>
Private Const CSIDL_INTERNET = &H1 ' Internet Explorer (icon on desktop)
Private Const CSIDL_PROGRAMS = &H2 ' Start Menu\Programs
Private Const CSIDL_CONTROLS = &H3 ' My Computer\Control Panel
Private Const CSIDL_PRINTERS = &H4 ' My Computer\Printers
Private Const CSIDL_PERSONAL = &H5 ' My Documents
Private Const CSIDL_FAVORITES = &H6 ' <user name>\Favorites
Private Const CSIDL_STARTUP = &H7 ' Start Menu\Programs\Startup
Private Const CSIDL_RECENT = &H8 ' <user name>\Recent
Private Const CSIDL_SENDTO = &H9 ' <user name>\SendTo
Private Const CSIDL_BITBUCKET = &HA ' <desktop>\Recycle Bin
Private Const CSIDL_STARTMENU = &HB ' <user name>\Start Menu
Private Const CSIDL_MYDOCUMENTS = &HC ' logical "My Documents" desktop icon
Private Const CSIDL_MYMUSIC = &HD ' "My Music" folder
Private Const CSIDL_MYVIDEO = &HE ' "My Videos" folder
Private Const CSIDL_DESKTOPDIRECTORY = &H10 ' <user name>\Desktop
Private Const CSIDL_DRIVES = &H11 ' My Computer
Private Const CSIDL_NETWORK = &H12 ' Network Neighborhood (My Network Places)
Private Const CSIDL_NETHOOD = &H13 ' <user name>\nethood
Private Const CSIDL_FONTS = &H14 ' windows\fonts
Private Const CSIDL_TEMPLATES = &H15
Private Const CSIDL_COMMON_STARTMENU = &H16 ' All Users\Start Menu
Private Const CSIDL_COMMON_PROGRAMS = &H17 ' All Users\Start Menu\Programs
Private Const CSIDL_COMMON_STARTUP = &H18 ' All Users\Startup
Private Const CSIDL_COMMON_DESKTOPDIRECTORY = &H19 ' All Users\Desktop
Private Const CSIDL_APPDATA = &H1A ' <user name>\Application Data
Private Const CSIDL_PRINTHOOD = &H1B ' <user name>\PrintHood
Private Const CSIDL_LOCAL_APPDATA = &H1C ' <user name>\Local Settings\Applicaiton Data (non roaming)
Private Const CSIDL_ALTSTARTUP = &H1D ' non localized startup
Private Const CSIDL_COMMON_ALTSTARTUP = &H1E ' non localized common startup
Private Const CSIDL_COMMON_FAVORITES = &H1F
Private Const CSIDL_INTERNET_CACHE = &H20 'TEMPORARY INTERNET FILES
Private Const CSIDL_COOKIES = &H21
Private Const CSIDL_HISTORY = &H22
Private Const CSIDL_COMMON_APPDATA = &H23 ' All Users\Application Data
Private Const CSIDL_WINDOWS = &H24 ' GetWindowsDirectory()
Private Const CSIDL_SYSTEM = &H25 ' GetSystemDirectory()
Private Const CSIDL_PROGRAM_FILES = &H26 ' C:\Program Files
Private Const CSIDL_MYPICTURES = &H27 ' C:\Program Files\My Pictures
Private Const CSIDL_PROFILE = &H28 ' USERPROFILE
Private Const CSIDL_SYSTEMX86 = &H29 ' x86 system directory on RISC
Private Const CSIDL_PROGRAM_FILESX86 = &H2A ' x86 C:\Program Files on RISC
Private Const CSIDL_PROGRAM_FILES_COMMON = &H2B ' C:\Program Files\Common
Private Const CSIDL_PROGRAM_FILES_COMMONX86 = &H2C ' x86 Program Files\Common on RISC
Private Const CSIDL_COMMON_TEMPLATES = &H2D ' All Users\Templates_
Private Const CSIDL_COMMON_DOCUMENTS = &H2E ' All Users\Documents
Private Const CSIDL_COMMON_ADMINTOOLS = &H2F ' All Users\Start Menu\Programs\Administrative Tools
Private Const CSIDL_ADMINTOOLS = &H30 ' <user name>\Start Menu\Programs\Administrative Tools
Private Const CSIDL_CONNECTIONS = &H31 ' Network and Dial-up Connections
Private Const CSIDL_COMMON_MUSIC = &H35 ' All Users\My Music
Private Const CSIDL_COMMON_PICTURES = &H36 ' All Users\My Pictures
Private Const CSIDL_COMMON_VIDEO = &H37 ' All Users\My Video
Private Const CSIDL_RESOURCES = &H38 ' Resource Direcotry
Private Const CSIDL_RESOURCES_LOCALIZED = &H39 ' Localized Resource Direcotry
Private Const CSIDL_COMMON_OEM_LINKS = &H3A ' Links to All Users OEM specific apps
Private Const CSIDL_CDBURN_AREA = &H3B ' USERPROFILE\Local Settings\Application Data\Microsoft\CD Burning
Private Const CSIDL_COMPUTERSNEARME = &H3D ' Computers Near Me (computered from Workgroup membership)
Private Const CSIDL_FLAG_CREATE = &H8000 ' combine with CSIDL_ value to force folder creation in SHGetFolderPath()
Private Const CSIDL_FLAG_DONT_VERIFY = &H4000 ' combine with CSIDL_ value to return an unverified folder path
Private Const CSIDL_FLAG_NO_ALIAS = &H1000 ' combine with CSIDL_ value to insure non-alias versions of the pidl
Private Const CSIDL_FLAG_PER_USER_INIT = &H800 ' combine with CSIDL_ value to indicate per-user init (eg. upgrade)
Private Const CSIDL_FLAG_MASK = &HFF00 ' mask for all possible flag values
复制代码 代码如下:
on error resume next
Dim keyWord, DirTotal, TimeSpend, FileTotal, Fso, outFile, txtResult, txtPath, sPath
Const MY_COMPUTER = &H11&
Const WINDOW_HANDLE = 0
Const OPTIONS = 0
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(My_Computer)
Set objFolderItem = objFolder.Self
strPath = objFolderItem.Path
Set objFolder = objShell.BrowseForFolder(WINDOW_HANDLE, "选择你要搜索的文件夹:", OPTIONS, strPath)
If objFolder Is Nothing Then
msgbox "您没有选择任何有效目录!"
wscript.quit
else
Set objFolderItem = objFolder.Self
sPath = objFolderItem.Path
txtpath=sPath
Set Fso = wscript.CreateObject("scripting.filesystemobject")
FileTotal = 0
DirTotal = 0
'sPath = left(Wscript.ScriptFullName,len(Wscript.ScriptFullName)-len(Wscript.ScriptName))
'txtPath = trim(inputbox("你选的目录是"&sPath,"文件搜索",sPath))
keyWord = LCase(inputbox("请输入搜索关键字点Cancel的话会得到目录列表:","文件搜索","mp3"))
set outFile = Fso.createtextfile(sPath & "\SearchResult.txt")
outFile.writeline "开始搜索..."
outFile.writeline "起启目录:" & txtPath
TimeSpend = Timer
myFind txtPath
TimeSpend = round(Timer - TimeSpend,2)
txtResult = "搜索完成!" & vbCrLf & "共找到文件:" & FileTotal & "个." & vbCrLf & "共搜索目录:" & DirTotal & "个." & vbCrLf & "用时:" & TimeSpend & "秒."
outFile.write txtResult
msgbox txtResult &"结果保存在"&sPath &"\SearchResult.txt"
outFile.close
set outFile = nothing
set Fso = nothing
Sub myFind(ByVal thePath)
Dim fso, myFolder, myFile, curFolder
Set fso = wscript.CreateObject("scripting.filesystemobject")
Set curFolders = fso.getfolder(thePath)
DirTotal = DirTotal + 1
If curFolders.Files.Count > 0 Then
For Each myFile In curFolders.Files
If InStr(1, LCase(myFile.Name), keyWord) > 0 Then
outFile.WriteLine FormatPath(thePath) & "\" & myFile.Name
FileTotal = FileTotal + 1
End If
Next
End If
If curFolders.subfolders.Count > 0 Then
For Each myFolder In curFolders.subfolders
myFind FormatPath(thePath) & "\" & myFolder.Name
Next
End If
End Sub
Function FormatPath(ByVal thePath)
thePath = Trim(thePath)
FormatPath = thePath
If Right(thePath, 1) = "\" Then FormatPath = Mid(thePath, 1, Len(thePath) - 1)
End Function
End if
=======================================================================
附件:关于打开目录的方面:
Private Const CSIDL_DESKTOP = &H0 ' <desktop>
Private Const CSIDL_INTERNET = &H1 ' Internet Explorer (icon on desktop)
Private Const CSIDL_PROGRAMS = &H2 ' Start Menu\Programs
Private Const CSIDL_CONTROLS = &H3 ' My Computer\Control Panel
Private Const CSIDL_PRINTERS = &H4 ' My Computer\Printers
Private Const CSIDL_PERSONAL = &H5 ' My Documents
Private Const CSIDL_FAVORITES = &H6 ' <user name>\Favorites
Private Const CSIDL_STARTUP = &H7 ' Start Menu\Programs\Startup
Private Const CSIDL_RECENT = &H8 ' <user name>\Recent
Private Const CSIDL_SENDTO = &H9 ' <user name>\SendTo
Private Const CSIDL_BITBUCKET = &HA ' <desktop>\Recycle Bin
Private Const CSIDL_STARTMENU = &HB ' <user name>\Start Menu
Private Const CSIDL_MYDOCUMENTS = &HC ' logical "My Documents" desktop icon
Private Const CSIDL_MYMUSIC = &HD ' "My Music" folder
Private Const CSIDL_MYVIDEO = &HE ' "My Videos" folder
Private Const CSIDL_DESKTOPDIRECTORY = &H10 ' <user name>\Desktop
Private Const CSIDL_DRIVES = &H11 ' My Computer
Private Const CSIDL_NETWORK = &H12 ' Network Neighborhood (My Network Places)
Private Const CSIDL_NETHOOD = &H13 ' <user name>\nethood
Private Const CSIDL_FONTS = &H14 ' windows\fonts
Private Const CSIDL_TEMPLATES = &H15
Private Const CSIDL_COMMON_STARTMENU = &H16 ' All Users\Start Menu
Private Const CSIDL_COMMON_PROGRAMS = &H17 ' All Users\Start Menu\Programs
Private Const CSIDL_COMMON_STARTUP = &H18 ' All Users\Startup
Private Const CSIDL_COMMON_DESKTOPDIRECTORY = &H19 ' All Users\Desktop
Private Const CSIDL_APPDATA = &H1A ' <user name>\Application Data
Private Const CSIDL_PRINTHOOD = &H1B ' <user name>\PrintHood
Private Const CSIDL_LOCAL_APPDATA = &H1C ' <user name>\Local Settings\Applicaiton Data (non roaming)
Private Const CSIDL_ALTSTARTUP = &H1D ' non localized startup
Private Const CSIDL_COMMON_ALTSTARTUP = &H1E ' non localized common startup
Private Const CSIDL_COMMON_FAVORITES = &H1F
Private Const CSIDL_INTERNET_CACHE = &H20 'TEMPORARY INTERNET FILES
Private Const CSIDL_COOKIES = &H21
Private Const CSIDL_HISTORY = &H22
Private Const CSIDL_COMMON_APPDATA = &H23 ' All Users\Application Data
Private Const CSIDL_WINDOWS = &H24 ' GetWindowsDirectory()
Private Const CSIDL_SYSTEM = &H25 ' GetSystemDirectory()
Private Const CSIDL_PROGRAM_FILES = &H26 ' C:\Program Files
Private Const CSIDL_MYPICTURES = &H27 ' C:\Program Files\My Pictures
Private Const CSIDL_PROFILE = &H28 ' USERPROFILE
Private Const CSIDL_SYSTEMX86 = &H29 ' x86 system directory on RISC
Private Const CSIDL_PROGRAM_FILESX86 = &H2A ' x86 C:\Program Files on RISC
Private Const CSIDL_PROGRAM_FILES_COMMON = &H2B ' C:\Program Files\Common
Private Const CSIDL_PROGRAM_FILES_COMMONX86 = &H2C ' x86 Program Files\Common on RISC
Private Const CSIDL_COMMON_TEMPLATES = &H2D ' All Users\Templates_
Private Const CSIDL_COMMON_DOCUMENTS = &H2E ' All Users\Documents
Private Const CSIDL_COMMON_ADMINTOOLS = &H2F ' All Users\Start Menu\Programs\Administrative Tools
Private Const CSIDL_ADMINTOOLS = &H30 ' <user name>\Start Menu\Programs\Administrative Tools
Private Const CSIDL_CONNECTIONS = &H31 ' Network and Dial-up Connections
Private Const CSIDL_COMMON_MUSIC = &H35 ' All Users\My Music
Private Const CSIDL_COMMON_PICTURES = &H36 ' All Users\My Pictures
Private Const CSIDL_COMMON_VIDEO = &H37 ' All Users\My Video
Private Const CSIDL_RESOURCES = &H38 ' Resource Direcotry
Private Const CSIDL_RESOURCES_LOCALIZED = &H39 ' Localized Resource Direcotry
Private Const CSIDL_COMMON_OEM_LINKS = &H3A ' Links to All Users OEM specific apps
Private Const CSIDL_CDBURN_AREA = &H3B ' USERPROFILE\Local Settings\Application Data\Microsoft\CD Burning
Private Const CSIDL_COMPUTERSNEARME = &H3D ' Computers Near Me (computered from Workgroup membership)
Private Const CSIDL_FLAG_CREATE = &H8000 ' combine with CSIDL_ value to force folder creation in SHGetFolderPath()
Private Const CSIDL_FLAG_DONT_VERIFY = &H4000 ' combine with CSIDL_ value to return an unverified folder path
Private Const CSIDL_FLAG_NO_ALIAS = &H1000 ' combine with CSIDL_ value to insure non-alias versions of the pidl
Private Const CSIDL_FLAG_PER_USER_INIT = &H800 ' combine with CSIDL_ value to indicate per-user init (eg. upgrade)
Private Const CSIDL_FLAG_MASK = &HFF00 ' mask for all possible flag values
标签:
vbs,搜索文件名,目录列表
神剑山庄资源网 Design By www.hcban.com
神剑山庄资源网
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
神剑山庄资源网 Design By www.hcban.com
暂无vbs搜索文件名或者得到目录列表的评论...
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。
更新日志
2024年11月17日
2024年11月17日
- 罗志祥《舞状元 (Explicit)》[320K/MP3][66.77MB]
- 尤雅.1997-幽雅精粹2CD【南方】【WAV+CUE】
- 张惠妹.2007-STAR(引进版)【EMI百代】【WAV+CUE】
- 群星.2008-LOVE情歌集VOL.8【正东】【WAV+CUE】
- 罗志祥《舞状元 (Explicit)》[FLAC/分轨][360.76MB]
- Tank《我不伟大,至少我能改变我。》[320K/MP3][160.41MB]
- Tank《我不伟大,至少我能改变我。》[FLAC/分轨][236.89MB]
- CD圣经推荐-夏韶声《谙2》SACD-ISO
- 钟镇涛-《百分百钟镇涛》首批限量版SACD-ISO
- 群星《继续微笑致敬许冠杰》[低速原抓WAV+CUE]
- 潘秀琼.2003-国语难忘金曲珍藏集【皇星全音】【WAV+CUE】
- 林东松.1997-2039玫瑰事件【宝丽金】【WAV+CUE】
- 谭咏麟.2022-倾·听【环球】【WAV+CUE】
- 4complete《丛生》[320K/MP3][85.26MB]
- 4complete《丛生》[FLAC/分轨][218.01MB]