notepad++

发布于:2025-05-23 ⋅ 阅读:(17) ⋅ 点赞:(0)

设置

右键菜单

::===========================================================================
:: bdrun_admin.cmd version 0.0.1
::---------------------------------------------------------------------------
:: enable/disable notepad++ context menu
:: 
:: Copyright (c) 2016-2018 Anon Technologies, Inc. All rights reserved.
::===========================================================================
:: when        who     what, where, why
:: ---------   ---     ------------------------------------------------------
:: 2023-9-15   bob     enable context menu by regedit
::===========================================================================

@echo off
chcp 65001

cd /d %~dp0

title Notepad++ 石键菜单添加/删除工具
SetLocal EnableDelayedExpansion

echo 1.添加 Notepad++ 右键菜单
echo --------------------------
echo 2.删除 Notepad++ 右键菜单
echo --------------------------

Set /p u=请输入数字并按 Enter 确定:

If "%u%"=="1" call :reg_npp_ctx_menu
If "%u%"=="2" call :unreg_npp_ctx_menu

goto :eof

:reg_npp_ctx_menu
    echo enable context menu for %cd%\notepad++.exe
    reg add "HKEY_CLASSES_ROOT\*\shell\Notepad++" /t REG_SZ /v "" /d "Edit with &Notepad++" /f
    reg add "HKEY_CLASSES_ROOT\*\shell\Notepad++" /t REG_EXPAND_SZ /v "Icon" /d "%cd%\notepad++.exe,0" /f
    reg add "HKEY_CLASSES_ROOT\*\shell\Notepad++\command" /t REG_SZ /v "" /d "%cd%\notepad++.exe ""%%1""" /f
    pause
goto :eof

:unreg_npp_ctx_menu
    echo disable context menu for %cd%\notepad++.exe
    reg delete "HKEY_CLASSES_ROOT\*\shell\Notepad++" /f
    pause
goto :eof