You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows 11下自定义.txt文件右键菜单命令失效的技术求助

解决Windows 11 UWP记事本环境下.txt文件自定义右键菜单失效问题

Windows 11对UWP应用关联的文件采用了新的注册表管理逻辑,原txtfile/txtfilelegacy节点的配置不再生效,需要通过SystemFileAssociations节点添加自定义右键菜单,以下是可行方案:

方案1:为所有用户添加右键菜单(需管理员权限)

创建并导入以下注册表脚本:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\.txt\shell\Additional command 1]
"MUIVerb"="Additional command 1"  # 自定义菜单显示名称
"Icon"="somepath/someprogram.exe,0"  # 可选:设置菜单图标,逗号后为图标索引
# 若需按住Shift才显示菜单,保留下方一行;否则删除
"Extended"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\.txt\shell\Additional command 1\command]
@="\"somepath/someprogram.exe\" -someoption \"%1\""

方案2:仅为当前用户添加右键菜单(无需管理员权限)

将方案1中的HKEY_LOCAL_MACHINE替换为HKEY_CURRENT_USER即可:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Classes\SystemFileAssociations\.txt\shell\Additional command 1]
"MUIVerb"="Additional command 1"
"Icon"="somepath/someprogram.exe,0"  # 可选

[HKEY_CURRENT_USER\SOFTWARE\Classes\SystemFileAssociations\.txt\shell\Additional command 1\command]
@="\"somepath/someprogram.exe\" -someoption \"%1\""

额外设置:让菜单直接显示在右键主菜单(而非“更多选项”)

若希望自定义菜单直接出现在右键主菜单而非折叠到“显示更多选项”中,可在对应shell子项中添加Position配置:

# 在[...\shell\Additional command 1]节点下新增
"Position"="Top"  # 或设为"Bottom"将菜单放在底部

操作步骤

  1. 将上述脚本保存为后缀为.reg的文件(如AddTxtContextMenu.reg)
  2. 双击运行文件,确认导入注册表
  3. 重启文件资源管理器(或注销后重新登录),右键点击.txt文件即可看到自定义菜单

内容的提问来源于stack exchange,提问作者AntoineL

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.06 08:53:15