ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

Windows 右键菜单添加cmd管理员 vscode编辑等

2021-08-15 13:00:41  阅读:253  来源: 互联网

标签:shell Windows HKEY cmd CLASSES 右键 Background Directory ROOT


文件右键添加编辑功能

效果:
image

给任意后缀的文件都加了这个菜单项
注册表需导入项:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\editWith]
@=""
"MUIVerb"="&编辑"
"Subcommands"=""

[HKEY_CLASSES_ROOT\*\shell\editWith\shell]

[HKEY_CLASSES_ROOT\*\shell\editWith\shell\notepad]
@="记事本"
"Icon"="C:\\Windows\\System32\\notepad.exe"

[HKEY_CLASSES_ROOT\*\shell\editWith\shell\notepad\command]
@="\"C:\\Windows\\System32\\notepad.exe\" \"%1\""

[HKEY_CLASSES_ROOT\*\shell\editWith\shell\VS code]
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe"

[HKEY_CLASSES_ROOT\*\shell\editWith\shell\VS code\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\""

文件夹空白处右键添加此处打开cmd

效果图:
image
注册表:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\cmdShow]
@="@shell32.dll,-8506"

[HKEY_CLASSES_ROOT\Directory\Background\shell\cmdShow\command]
@="cmd.exe /s /k pushd \"%V\""

按下shift显示管理员身份运行cmd

注意,键名必须是runas

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@="在此处打开命令窗口(管理员)"
"ShowBasedOnVelocityId"=dword:00639bc8
"Extended"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

再添加一个子菜单用管理员打开powershell

迫不得已用子菜单,因为同一级只能有一个runas项,这个runas被cmd用了,只好弄个子菜单凑合凑合。不过我一般也用不到powershell

效果:
image
注册表:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin]
@=""
"Subcommands"=""
"MUIVerb"="powershell管理员"
"Extended"=""
"ShowBasedOnVelocityId"=dword:00639bc8

[HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin\shell]

[HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin\shell\runas]
@="Powershell(管理员)"

[HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin\shell\runas\command]
@="powershell.exe -noexit -command Set-Location -literalPath '%V'"

改完后注册表结构:
image

标签:shell,Windows,HKEY,cmd,CLASSES,右键,Background,Directory,ROOT
来源: https://www.cnblogs.com/wangbingbing/p/15143173.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有