Win10系统右键添加Powershell和命令提示符方法
润色后的文章
在Win10系统中,我们可以通过按下SHIFT键加右键来呼出右键菜单中的Powershell控制台选项。然而,对于那些经常需要进行操作的用户来说,这种方式可能有些繁琐。下面我将分享一种方法,可以让我们无需按下Shift键就能直接使用Powershell控制台选项。
首先,我们需要删除原有的注册表项,包括`-HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere`、`-HKEY_CLASSES_ROOT\Directory\Background\shell\runas`和`-HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin`。
接下来,我们按照以下步骤进行设置:
1. 右键点击空白处:命令行
```markdown
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere]
@="在此处打开命令行窗口"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere\command]
@="cmd.exe-noexit-commandSet-Location-literalPath\"%V\""
```
2. 右键点击空白处:命令行(管理员)
```markdown
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@="在此处打开命令行窗口(管理员)"
"ShowBasedOnVelocityId"=dword:00639bc8
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="cmd.exe/s/kpushd\"%V\""
```
3. 按下SHIFT键加右键:Powershell(管理员)
```markdown
[HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin]
@="在此处打开Powershell窗口(管理员)"
"Extended"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin\command]
@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\"-windowstylehidden-Command$stpath=pwd;Start-ProcessPowerShell-ArgumentList\\\"-NoExit\\\",\\\"-CommandSet-Location-literalPath'%V'\\\"-verbRunAs"
```
4. 设置右键管理员打开命令行的另一种方法(可用来替换上述第2步)
通过Powershell调用,会有一次Powershell窗口的闪现。去掉以下几行的分号`[;]`来取消注释。
```markdown
[-HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHereAdmin]
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHereAdmin]
@="在此处打开命令行窗口(管理员)"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHereAdmin\command]
@="PowerShell-windowstylehidden-Command\"Start-Processcmd.exe-ArgumentList'/s,/k,pushd,%V'-VerbRunAs\""
```
通过以上设置,我们可以更方便地使用右键菜单中的Powershell控制台选项,提高操作效率。希望以上内容能对你有所帮助!
常见问题
- Win10如何查看硬盘序列号?Win10查看硬盘序列号的方法
- 电脑Default Boot Device Missing or Boot Failed解决方法
- Win11 22H2镜像下载|Windows11 22H2正式版原版镜像大全(附更新内容)
- Win10获取超级管理员权限教程(注册表添加右键获取管理员权限)
- Win10找不到支持Windows Hello人脸的摄像头如何解决?
- Win10 20H2更新KB4598242错误怎么办?解决教程
- Win10开机后登录界面没有密码输入框怎么解决?
- Win10提示NVIDIA control panel is not found错误的解决方法
- 需要提升权限才能运行dism解决方法
- 任务栏假死,任务栏装死怎么解决?任务栏点不动啊!