找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 39860|回复: 12

[文件操作] Everything 快速搜索定位文件(es支持命令行)

[复制链接]
发表于 2015-10-22 17:18:15 | 显示全部楼层 |阅读模式
本帖最后由 依山居 于 2016-9-9 22:21 编辑

善用佳软介绍:
Everything(官网|中文主页|教程)是速度最快的文件名搜索软件。其速度之快令人震惊,百G硬盘几十万个文件,可以在几秒钟之内完成索引;文件名搜索瞬间呈现结果。它小巧免费,支持中文,支持正则表达式,可以通过HTTP或FTP分享搜索结果。


本站也有转载过相关文章 [转载]Everything:速度最快的文件搜索工具
http://www.bathome.net/viewthrea ... p;extra=&page=1

命令行 接口es.exe 第三方工具已经有收录 http://www.bathome.net/s/tool/index.html

c:\>es -h
-r Search the database using a basic POSIX regular expression.
-i Does a case sensitive search.
-w Does a whole word search.
-p Does a full path search.
-h --help Display this help.
-n <num> Limit the amount of results shown to <num>.
-s Sort by full path.



Everything.exe [filename] [options]

filename        Open the specified file list.

-?        Show this help.
-admin        Run Everything as Administrator.
-admin-server-share-links        Use \\Server\C$ links for ETP connections.
-app-data        Store data in application data.
-bookmark <name>        Open a bookmark.
-case        Enable case matching.
-choose-language        Show the language selection page.
-choose-volumes        Do not automatically index volumes.
-config <filename>        The filename of the ini file.
-connect <user:pass@host:port>        Connect to an ETP server.
-console        Show the debugging console.
-create-filelist <filename> <path>        Create a file list of a path.
-db <filename>        The filename of the database.
-debug        Show the debugging console.
-diacritics        Enable diacritics matching.
-disable-run-as-admin        Disable run as administrator.
-disable-update-notification        Disable update notification on startup.
-drive-links        Use C: links for ETP connections.
-edit <filename>        Open a file list with the file list editor.
-enable-run-as-admin        Enable run as administrator.
-enable-update-notification        Enable update notification on startup.
-exit        Exit "Everything".
-filelist <filename>        Open a file list.
-filename <filename>        Search for a file or folder by filename.
-filter <name>        Select a search filter.
-ftp-links        Use ftp://host/C: links for ETP connections.
-fullscreen        Show the search window fullscreen.
-h        Show this help.
-help        Show this help.
-install <location>        Install Everything to a new location.
-install-client-service        Install the "Everything" client as a service.
-install-config <filename>        Install the specified ini file.
-install-desktop-shortcut        Install desktop shortcut.
-install-efu-association        Install EFU file association.
-install-folder-context-menu        Install folder context menus.
-install-quick-launch-shortcut        Install Quick Launch shortcut.
-install-run-on-system-startup        Install "Everything" from the system startup.
-install-service        Install and start the "Everything" service.
-install-service-port <port>        Install the Everything service on the specified port.
-install-start-menu-shortcuts        Install "Everything" shortcuts from the Start menu.
-install-url-protocol        Install URL Protocol.
-instance <name>        The name of the Everything instance.
-load-delay <milliseconds>        The delay in milliseconds before loading the database.
-l        Load the local database.
-language <langID>        Set the language to the specified language ID.
-local        Load the local database.
-matchpath        Enable full path matching.
-maximized        Maximize the search window.
-minimized        Minimize the search window.
-newwindow        Create a new search window.
-noapp-data        Store data in executable location.
-nocase        Disable case matching.
-nodb        Do not save to or load from the "Everything" database file.
-nodiacritics        Disable diacritics matching.
-nofullscreen        Show the search window in a window.
-nomatchpath        Disable full path matching.
-nomaximized        Unmaximize the search window.
-nominimized        Unminimize the search window.
-nonewwindow        Show an existing search window.
-noontop        Disable always ontop.
-noregex        Disable Regex.
-noverbose        Display only basic debug messages.
-nowholeword        Disable match whole word.
-noww        Disable match whole word.
-ontop        Enable always ontop.
-p <path>        Search for a path.
-parentpath <path>        Search for the parent of a path.
-path <path>        Search for a path.
-quit        Exit "Everything".
-read-only        Loads the database in read-only mode.
-regex        Enable Regex.
-reindex        Force database rebuild.
-s <text>        Set the search.
-search <text>        Set the search.
-server-share-links        Use \\Server\C: links for ETP connections.
-service-port <port>        Connect to the Everything service on the specified port.
-sort <name>        Set the sort to the specified name.
-sort-ascending        Sort ascending.
-sort-descending        Sort descending.
-start-client-service        Start the Everything client service.
-start-service        Start the Everything service.
-startup        Run Everything in the background.
-stop-client-service        Stop the Everything client service.
-stop-service        Stop the Everything service.
-svc        Run Everything as a service.
-svc-port <port>        Run the Everything service on the specified port.
-uninstall [path]        Uninstall Everything from the specified path.
-uninstall-client-service        Uninstall the "Everything" client service.
-uninstall-desktop-shortcut        Uninstall desktop shortcut.
-uninstall-efu-association        Uninstall EFU file association.
-uninstall-folder-context-menu        Uninstall folder context menus.
-uninstall-quick-launch-shortcut        Uninstall Quick Launch shortcut.
-uninstall-run-on-system-startup        Remove "Everything" from the system startup.
-uninstall-service        Uninstall the "Everything" service.
-uninstall-start-menu-shortcuts        Uninstall "Everything" shortcuts from the Start menu.
-uninstall-url-protocol        Uninstall URL Protocol.
-uninstall-user        Uninstall user files.
-update        Save the database to disk.
-url <[es:]search>        Set the search from an ES: URL.
-verbose        Display all debug messages.
-wholeword        Enable match whole word.
-ww        Enable match whole word.

搜索语法:
  1. 操作符:
  2.         space        与 (AND)
  3.         |        或 (OR)
  4.         !        非 (NOT)
  5.         < >        分组
  6.         " "        搜索引号内的词组.

  7. 通配符:
  8.         *        匹配 0 个或多个字符.
  9.         ?        匹配 1 个字符.
  10.         *.        匹配不包含扩展的文件名.
  11.         *.*        与 * 相同

  12. 宏:
  13.         quot:        双引号 (")
  14.         apos:        单引号 (')
  15.         amp:        与号 (&)
  16.         lt:        小于 (<)
  17.         gt:        大于 (>)
  18.         #x:        Unicode字符代码 x.

  19. 修饰符:
  20.         ascii:        启用快速 ASCII 大小写对比.
  21.         case:        区分大小写.
  22.         diacritics:        匹配变音标记.
  23.         file:        仅匹配文件.
  24.         folder:        仅匹配文件夹.
  25.         noascii:        禁用快速 ASCII 大小写对比.
  26.         nocase:        不区分大小写.
  27.         nodiacritics:        不匹配变音标记.
  28.         nofileonly:        仅不允许文件.
  29.         nofolderonly:        仅不允许文件夹.
  30.         nopath:        不匹配路径.
  31.         noregex:        禁用正则表达式.
  32.         nowfn:        不匹配完整文件名.
  33.         nowholefilename:        不匹配完整文件名.
  34.         nowholeword:        仅禁用全字匹配.
  35.         nowildcards:        禁用通配符.
  36.         noww:        仅禁用全字匹配.
  37.         path:        匹配路径和文件名.
  38.         regex:        启用正则表达式.
  39.         utf8:        禁用快速 ASCII 大小写对比.
  40.         wfn:        匹配完整文件名.
  41.         wholefilename:        匹配完整文件名.
  42.         wholeword:        仅匹配全字符.
  43.         wildcards:        启用通配符.
  44.         ww:        仅全字匹配.

  45. 函数:
  46.         attrib:<attributes>        搜索指定的文件属性的文件和文件夹.
  47.         attributes:<attributes>        搜索指定的文件属性的文件和文件夹.
  48.         child:<filename>        搜索包含匹配文件名文件的文件夹.
  49.         dateaccessed:<date>        搜索指定访问时间的文件和文件夹.
  50.         datecreated:<date>        搜索指定创建日期的文件和文件夹.
  51.         datemodified:<date>        搜索指定修改日期的文件和文件夹.
  52.         daterun:<date>        搜索指定打开时间的文件和文件夹.
  53.         da:<date>        搜索指定访问时间的文件和文件夹.
  54.         dc:<date>        搜索指定创建日期的文件和文件夹.
  55.         dm:<date>        搜索指定修改日期的文件和文件夹.
  56.         dr:<date>        搜索指定打开时间的文件和文件夹.
  57.         dupe:        搜索重复的文件名.
  58.         empty:        搜索空文件夹.
  59.         ext:<list>        搜索和列表中指定的扩展名匹配的文件 (扩展名以分号分隔).
  60.         fsi:<index>        搜索指定盘符索引中文件或文件夹 (索引 0 表示 C 盘, 以此类推).
  61.         len:<length>        搜索和指定的文件名长度相匹配的文件和文件夹.
  62.         parents:<count>        搜索有指定数目父文件夹的文件和文件夹.
  63.         rc:<date>        搜索指定最近修改日期的文件和文件夹.
  64.         recentchange:<date>        搜索指定最近修改日期的文件和文件夹.
  65.         root:        搜索没有父文件夹的文件和文件夹.
  66.         runcount:<count>        搜索指定打开次数的文件和文件夹.
  67.         size:<size>        搜索指定大小的文件 (以字节为单位).
  68.         type:<type>        搜索指定的文件类型的文件和文件夹.

  69. 函数语法:
  70.         function:value        等于某设定值.
  71.         function:<=value        小于等于某设定值.
  72.         function:<value        小于某设定值.
  73.         function:=value        等于某设定值.
  74.         function:>value        大于某设定值.
  75.         function:>=value        大于等于某设定值.
  76.         function:start..end        在起始值和终止值的范围内.
  77.         function:start-end        在起始值和终止值的范围内.

  78. 大小语法:
  79.         size[kb|mb|gb]

  80. 大小常数:
  81.         empty
  82.         tiny        0 KB < 大小 <= 10 KB
  83.         small        10 KB < 大小 <= 100 KB
  84.         medium        100 KB < 大小 <= 1 MB
  85.         large        1 MB < 大小 <= 16 MB
  86.         huge        16 MB < 大小 <= 128 MB
  87.         gigantic        大小 > 128 MB
  88.         unknown

  89. 日期语法:
  90.         year
  91.         month/year 或者 year/month 取决于本地设置
  92.         day/month/year, month/day/year 或者 year/month/day 取决于本地设置

  93. 日期常数:
  94.         today
  95.         yesterday
  96.         tomorrow
  97.         <last|past|prev|current|this|coming|next><year|month|week>
  98.         <last|past|prev|coming|next><x><years|months|weeks|hours|minutes|mins|seconds|secs>
  99.         january|february|march|april|may|june|july|august|september|october|november|december
  100.         jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec
  101.         sunday|monday|tuesday|wednesday|thursday|friday|saturday
  102.         sun|mon|tue|wed|thu|fri|sat
  103.         unknown

  104. 属性常数:
  105.         A        存档
  106.         C        压缩
  107.         D        目录
  108.         E        加密
  109.         H        隐藏
  110.         I        未索引的内容
  111.         L        重解析点
  112.         N        一般
  113.         O        离线
  114.         P        稀疏文件
  115.         R        只读
  116.         S        系统
  117.         T        临时
  118.         V        设备
复制代码
 楼主| 发表于 2015-10-22 17:32:35 | 显示全部楼层
举例搜索出电脑中有sed.exe的目录:
  1. c:\>es -i "sed.exe"
  2. C:\cygwin64\bin\sed.exe
  3. C:\cygwinx86\bin\sed.exe
  4. D:\Dev\Git\usr\bin\sed.exe
  5. D:\Dev\gnuwin32\GetGnuWin32\bin\sed.exe
复制代码
 楼主| 发表于 2015-10-22 18:17:12 | 显示全部楼层
本帖最后由 依山居 于 2015-10-29 21:39 编辑

需要erverything 运行状态,否则es不能工作。

  1. c:\>es -r "[ww]cmd"
  2. C:\Program Files\Double Commander\pixmaps\dctheme\32x32\actions\cm_showcmdlinehistory.png
  3. C:\Program Files (x86)\AliWorkbench\3.03.06N\WWCmd.exe
  4. C:\Program Files (x86)\AliWorkbench\3.05.05N\WWCmd.exe
  5. D:\AliWorkbenchData\System\Update\0\remote\0_beta_package\2.08.12N\WWCmd.exe.PE
  6. D:\AliWorkbenchData\System\Update\0\remote\0_beta_package\3.05.05N\WWCmd.exe.PE

  7. c:\>es -r "[ww]cmd"
  8. Everything IPC window not found, IPC unavailable.
复制代码
再贴个例子:可以看到3秒以内完成了搜索。比用dir来扫描文件速度要快很多。时间是生命
  1. 21:24:30.50 D:\Dev\py3564em>es -r "system.ini$"
  2. C:\Windows\system.ini
  3. C:\Windows\winsxs\amd64_microsoft-windows-coreos_31bf3856ad364e35_6.1.7601.17514_none_83784bb654f0d178\syst
  4. em.ini

  5. 21:24:31.59 D:\Dev\py3564em>
复制代码
发表于 2015-10-22 21:03:55 | 显示全部楼层
好东西,重装必备三剑客:
everything
listary
autohotkey
 楼主| 发表于 2015-10-22 21:20:24 | 显示全部楼层
回复 4# CrLf


    第三方库里光有ES不行的。
需要everything 运行着才能用。
发表于 2015-10-22 22:28:53 | 显示全部楼层
回复 5# 依山居


    没注意,确实提示 Everything IPC window not found, IPC unavailable.
 楼主| 发表于 2015-10-22 22:38:40 | 显示全部楼层
回复 6# CrLf


    官方有SDK,你给调SDK写个吗
发表于 2015-10-22 22:45:44 | 显示全部楼层
回复 7# 依山居


    不需要,everything.exe -svc 就能运行服务了,想用的人自己去下好了
 楼主| 发表于 2015-11-3 09:24:44 | 显示全部楼层
贴个例子
  1. @echo off

  2. :: 现在欲删除文本名称中“值”字前面为3位数的文本(比如上列中的 wj3苏州-114值-记录期),也即倒数第9个字符是"_"的文本。这样的代码如何写?
  3. :: http://www.bathome.net/thread-37925-1-1.html

  4. :: everything 的命令行工具es 搜索文件很好用。
  5. :: http://www.bathome.net/thread-37744-1-1.html

  6. ::生成测试用的空文件
  7. echo;>wj1苏州-64值-记录期.txt
  8. echo;>wj3苏州-114值-记录期.txt
  9. echo;>wj12苏州-86值-记录期.txt



  10. echo es 搜索文件用法,开启正则的时候\是转义符,所是双斜杠\\
  11. es -r "D:\\temp\\stringtie\\.*-[0-9]{3}值-记录期\.txt"

  12. echo ==============
  13. echo.
  14. echo 可以只搜索文件名,可以搜索到硬盘上文件名匹配的文件
  15. es -r ".*-[0-9]{3}值-记录期\.txt$


  16. echo ==============
  17. echo.
  18. echo 以下是放在for 中执行

  19. for /f "tokens=*" %%a in ('es -r  "D:\\temp\\stringtie\\.*-[0-9]{3}值-记录期\.txt"') do (
  20.         echo 要删除%%a
  21.         echo del %%a 只是测试用,自行修改删除命令
  22.         )

  23. pause
复制代码
发表于 2016-7-29 11:00:45 | 显示全部楼层
回复 9# 依山居

请问有没有获取不包含文件名的路径的方法?
发表于 2016-9-9 20:35:03 | 显示全部楼层
本帖最后由 DiamondbacK 于 2016-9-9 20:37 编辑

回复 10# Uns8083


用 for in loop 从完整路径中解析父目录路径,或者稍微读一读 Everything 自带帮助:
  1. es "child:filename"
复制代码

评分

参与人数 1技术 +1 收起 理由
codegay + 1 1

查看全部评分

发表于 2016-9-9 22:29:54 | 显示全部楼层
在pypi搜了一下,发现这个 :findeverything
https://pypi.python.org/pypi/findeverything/0.1.1
python 实现的 利用everything实现快速搜索文件。

源码这里:作者把es.exe base64后放到源码中了。
https://github.com/yejinlei/abou ... g/findeverything.py

评分

参与人数 1技术 +1 收起 理由
依山居 + 1 1

查看全部评分

发表于 2018-1-9 22:28:01 | 显示全部楼层
类似的命令行搜索工具fzf.exe,效果类似于vim的ctrlP
不过还能绑定其他按键,比如到粘贴板 用clip,直接用指定编辑器编辑,less预览等
详见
地址https://github.com/junegunn/fzf
自行发掘
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-17 07:11 , Processed in 0.030796 second(s), 9 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表