from ctypes import windll
from ctypes import create_unicode_buffer
from ctypes import byref
from win32api import ShellExecute
def search_files(file):
ans = []
append = ans.append
Search = windll.LoadLibrary("everything64.dll")
strBuff = create_unicode_buffer(255)
Search.Everything_SetSearchW(file)
Search.Everything_QueryW(True)
Results = Search.Everything_GetNumResults()
for index in range(Results):
Search.Everything_GetResultFullPathNameW(index,byref(strBuff),len(strBuff))
append(strBuff.value)
del Search
del strBuff
return ans
if __name__=='__main__':
file = input("请输入需要搜索的文件,如*.cpp\n")
ans = search_files(file)
if ans:
with open("result.txt",'w') as fp:
for file in ans:
if '$' in file:
continue
fp.write(file+'\n')
try:
ShellExecute(0, 'open', "Uedit32.exe", 'result.txt','',1)
except:
ShellExecute(0, 'open', "notepad.exe", 'result.txt','',1)
调用Everything SDK进行快速搜索文件
猜你喜欢
转载自blog.csdn.net/qq523176585/article/details/84877305
今日推荐
周排行