当前位置:首页 > Win10教程

Win10系统右键添加Powershell和命令提示符方法

更新日期:2024-06-26 13:02来源:互联网

润色后的文章

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控制台选项,提高操作效率。希望以上内容能对你有所帮助!

僵嘟荚嘟

僵嘟荚嘟是一款非常好玩的塔防类游戏,每一次的挑战都将考验玩家的策略能力,解锁新关卡,为游戏增添更多乐趣和挑战,高难度的挑战任务让玩家在游戏中接受更多挑战,挑战自
立即下载

系统下载排行