Everything的批处理工具,用于注册在文件夹右键
注册在文件夹的右键菜单,方便使用Everything搜索此文件夹内的文件
@echo off
title 注册Everything到右键菜单 - pythonopen.com - 20260109
setlocal enabledelayedexpansion
:: 检查是否为管理员权限
net session >nul 2>&1
if %errorLevel% neq 0 (
echo 请以管理员身份运行此脚本!
echo.
pause
exit /b 1
)
:: 设置变量
set "EXE_PATH=%~dp0Everything64.exe"
set "EXE_NAME=Everything64.exe"
:: 检查Everything64.exe是否存在
if not exist "%EXE_PATH%" (
echo 错误: 在当前目录找不到 %EXE_NAME%
echo 请确保 %EXE_NAME% 与此批处理文件在同一目录下
echo.
pause
exit /b 1
)
:: 获取Everything.exe的绝对路径
for %%I in ("%EXE_PATH%") do set "EXE_FULL_PATH=%%~fI"
echo ========================================
echo 正在注册Everything到文件夹右键菜单...
echo ========================================
echo.
:: 创建注册表项
reg add "HKCR\Directory\shell\EverythingSearch" /ve /d "使用Everything搜索此文件夹" /f
reg add "HKCR\Directory\shell\EverythingSearch" /v "Icon" /d "\"%EXE_FULL_PATH%\"" /f
reg add "HKCR\Directory\shell\EverythingSearch\command" /ve /d "\"%EXE_FULL_PATH%\" -path \"%%V\"" /f
:: 也可以添加到文件夹背景右键菜单
reg add "HKCR\Directory\Background\shell\EverythingSearch" /ve /d "使用Everything搜索此处" /f
reg add "HKCR\Directory\Background\shell\EverythingSearch" /v "Icon" /d "\"%EXE_FULL_PATH%\"" /f
reg add "HKCR\Directory\Background\shell\EverythingSearch\command" /ve /d "\"%EXE_FULL_PATH%\" -path \"%%V\"" /f
:: 添加到驱动器右键菜单
reg add "HKCR\Drive\shell\EverythingSearch" /ve /d "使用Everything搜索此驱动器" /f
reg add "HKCR\Drive\shell\EverythingSearch" /v "Icon" /d "\"%EXE_FULL_PATH%\"" /f
reg add "HKCR\Drive\shell\EverythingSearch\command" /ve /d "\"%EXE_FULL_PATH%\" -path \"%%V\"" /f
echo.
echo ========================================
echo 注册成功!
echo ========================================
echo.
echo 现在您可以在以下位置看到Everything搜索选项:
echo 1. 文件夹右键菜单
echo 2. 文件夹空白处右键菜单
echo 3. 驱动器右键菜单
echo.
echo 注意:可能需要重启资源管理器或注销/重新登录才能生效。
echo.
:: 询问是否重启资源管理器
set /p choice=是否立即重启资源管理器以使更改生效?(Y/N):
if /i "!choice!"=="Y" (
echo 正在重启资源管理器...
taskkill /f /im explorer.exe >nul 2>&1
start explorer.exe
echo 资源管理器已重启!
)
pause@echo off title 卸载Everything右键菜单 - pythonopen.com - 20260109 setlocal :: 检查是否为管理员权限 net session >nul 2>&1 if %errorLevel% neq 0 ( echo 请以管理员身份运行此脚本! echo. pause exit /b 1 ) echo ======================================== echo 正在卸载Everything右键菜单... echo ======================================== echo. :: 删除注册表项 reg delete "HKCR\Directory\shell\EverythingSearch" /f 2>nul reg delete "HKCR\Directory\Background\shell\EverythingSearch" /f 2>nul reg delete "HKCR\Drive\shell\EverythingSearch" /f 2>nul echo. echo ======================================== echo 卸载完成! echo ======================================== echo. echo Everything右键菜单项已成功移除。 echo 注意:可能需要重启资源管理器或注销/重新登录才能生效。 echo. :: 询问是否重启资源管理器 set /p choice=是否立即重启资源管理器以使更改生效?(Y/N): if /i "%choice%"=="Y" ( echo 正在重启资源管理器... taskkill /f /im explorer.exe >nul 2>&1 start explorer.exe echo 资源管理器已重启! ) pause
转载请注明出处。