精品免费在线观看-精品欧美-精品欧美成人bd高清在线观看-精品欧美高清不卡在线-精品欧美日韩一区二区

17站長網(wǎng)

17站長網(wǎng) 首頁 安全 安全教程 查看內(nèi)容

vbs搜索文件名或者得到目錄列表

2022-9-24 10:16| 查看: 2332 |來源: 互聯(lián)網(wǎng)

'把網(wǎng)上的一個(gè)小程序改得方便了點(diǎn),這個(gè)搜索次效率很好。 on error resume next Dim keyWord, DirTotal, TimeSpend, FileTotal, Fso, outFile, txtResult, txt ...

'把網(wǎng)上的一個(gè)小程序改得方便了點(diǎn),這個(gè)搜索次效率很好。
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("請輸入搜索關(guān)鍵字點(diǎn)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 & "個(gè)." & vbCrLf & "共搜索目錄:" & DirTotal & "個(gè)." & vbCrLf & "用時(shí):" & TimeSpend & "秒."
outFile.write txtResult
msgbox txtResult &"結(jié)果保存在"&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

=======================================================================

附件:關(guān)于打開目錄的方面:

Private Const CSIDL_DESKTOP = &H0 '

tag標(biāo)簽:vbs 目錄列表
本文最后更新于 2022-9-24 10:16,某些文章具有時(shí)效性,若有錯(cuò)誤或已失效,請?jiān)诰W(wǎng)站留言或聯(lián)系站長:[email protected]
·END·
站長網(wǎng)微信號:w17tui,關(guān)注站長、創(chuàng)業(yè)、關(guān)注互聯(lián)網(wǎng)人 - 互聯(lián)網(wǎng)創(chuàng)業(yè)者營銷服務(wù)中心

免責(zé)聲明:本站部分文章和圖片均來自用戶投稿和網(wǎng)絡(luò)收集,旨在傳播知識,文章和圖片版權(quán)歸原作者及原出處所有,僅供學(xué)習(xí)與參考,請勿用于商業(yè)用途,如果損害了您的權(quán)利,請聯(lián)系我們及時(shí)修正或刪除。謝謝!

17站長網(wǎng)微信二維碼

始終以前瞻性的眼光聚焦站長、創(chuàng)業(yè)、互聯(lián)網(wǎng)等領(lǐng)域,為您提供最新最全的互聯(lián)網(wǎng)資訊,幫助站長轉(zhuǎn)型升級,為互聯(lián)網(wǎng)創(chuàng)業(yè)者提供更加優(yōu)質(zhì)的創(chuàng)業(yè)信息和品牌營銷服務(wù),與站長一起進(jìn)步!讓互聯(lián)網(wǎng)創(chuàng)業(yè)者不再孤獨(dú)!

掃一掃,關(guān)注站長網(wǎng)微信

大家都在看

    熱門排行

      最近更新

        返回頂部
        主站蜘蛛池模板: 亚洲美女在线观看亚洲美女 | 色综合中文字幕天天在线 | 国内免费自拍视频 | 狠狠色丁香婷婷综合激情 | 在线亚洲日产一区二区 | 国产精品久久久久久亚洲小说 | 亚洲欧美精品中文字幕 | 国产成人综合久久精品尤物 | 国产在线观看91 | 亚洲成人在线播放视频 | 一级做a爰片性色毛片视频图片 | 亚洲精品免费网站 | 亚洲区免费 | 一级特黄aa毛片免费观看 | 国产综合欧美 | 亚洲高清视频一区 | 免费区一级欧美毛片 | 1区1区3区4区产品亚洲 | 成人网免费视频 | 中文字幕第2页 | 99久久国产综合精品女不卡 | 成人精品一级毛片 | 国产99视频在线 | 日韩中文字幕免费版 | 青青伊人精品 | 豆国产97在线 | 中国 | 免费国产精成人品 | 中文字幕在线网址 | 女人精69xxxxx免费无毒 | 久久窝窝国产精品午夜看15 | 久久国产精品国产精品 | 第一区 | 99一级毛片 | 国产一区二区精品 | 伊人日本| 韩国中文字幕 | 一a一级片| 免费看黄色片 | 中文一级毛片 | 麻豆成人传媒一区二区 | 欧美一级毛片在线播放 |