小黄人 发表于 2020-6-5 21:20:42

windows添加右键打开cmd和Powershell窗口

# 使用

鼠标右键:
在此处打开命令行窗口
在此处打开命令行窗口(管理员)
shift + 鼠标右键:

在此处打开 Powershell 窗口
在此处打开 Powershell 窗口(管理员)

# 代码

新建 xx.reg,输入以下代码

```
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHere]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
[-HKEY_CLASSES_ROOT\Directory\Background\shell\PowershellAdmin]

; 1.右键:命令行

@="在此处打开命令行窗口"


@="cmd.exe -noexit -command Set-Location -literalPath \"%V\""

; 2.右键:命令行(管理员)

@="在此处打开命令行窗口(管理员)"
"ShowBasedOnVelocityId"=dword:00639bc8


@="cmd.exe /s /k pushd \"%V\""

; 3.shift+右键:Powershell(管理员)

@="在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
"在此处打开命令行窗口"


@="cmd.exe -noexit -command Set-Location -literalPath \"%V\""

; 2.右键:命令行(管理员)

@="在此处打开命令行窗口(管理员)"
"ShowBasedOnVelocityId"=dword:00639bc8


@="cmd.exe /s /k pushd \"%V\""

; 3.shift+右键:Powershell(管理员)

@="在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"



@="cmd.exe -noexit -command Set-Location -literalPath \"%V\""

; 2.右键:命令行(管理员)

@="在此处打开命令行窗口(管理员)"
"ShowBasedOnVelocityId"=dword:00639bc8


@="cmd.exe /s /k pushd \"%V\""

; 3.shift+右键:Powershell(管理员)

@="在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
command]
@="cmd.exe -noexit -command Set-Location -literalPath \"%V\""

; 2.右键:命令行(管理员)

@="在此处打开命令行窗口(管理员)"
"ShowBasedOnVelocityId"=dword:00639bc8


@="cmd.exe /s /k pushd \"%V\""

; 3.shift+右键:Powershell(管理员)

@="在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
]
@="cmd.exe -noexit -command Set-Location -literalPath \"%V\""

; 2.右键:命令行(管理员)

@="在此处打开命令行窗口(管理员)"
"ShowBasedOnVelocityId"=dword:00639bc8


@="cmd.exe /s /k pushd \"%V\""

; 3.shift+右键:Powershell(管理员)

@="在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
"cmd.exe -noexit -command Set-Location -literalPath \"%V\""

; 2.右键:命令行(管理员)

@="在此处打开命令行窗口(管理员)"
"ShowBasedOnVelocityId"=dword:00639bc8


@="cmd.exe /s /k pushd \"%V\""

; 3.shift+右键:Powershell(管理员)

@="在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"


; 2.右键:命令行(管理员)

@="在此处打开命令行窗口(管理员)"
"ShowBasedOnVelocityId"=dword:00639bc8


@="cmd.exe /s /k pushd \"%V\""

; 3.shift+右键:Powershell(管理员)

@="在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
"在此处打开命令行窗口(管理员)"
"ShowBasedOnVelocityId"=dword:00639bc8


@="cmd.exe /s /k pushd \"%V\""

; 3.shift+右键:Powershell(管理员)

@="在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"

"ShowBasedOnVelocityId"=dword:00639bc8


@="cmd.exe /s /k pushd \"%V\""

; 3.shift+右键:Powershell(管理员)

@="在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
"ShowBasedOnVelocityId"=dword:00639bc8


@="cmd.exe /s /k pushd \"%V\""

; 3.shift+右键:Powershell(管理员)

@="在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
=dword:00639bc8


@="cmd.exe /s /k pushd \"%V\""

; 3.shift+右键:Powershell(管理员)

@="在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
command]
@="cmd.exe /s /k pushd \"%V\""

; 3.shift+右键:Powershell(管理员)

@="在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
]
@="cmd.exe /s /k pushd \"%V\""

; 3.shift+右键:Powershell(管理员)

@="在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
"cmd.exe /s /k pushd \"%V\""

; 3.shift+右键:Powershell(管理员)

@="在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"


; 3.shift+右键:Powershell(管理员)

@="在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
"在此处打开 Powershell 窗口(管理员)"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"

"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
"Extended"=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
=""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
""


@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"



@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
command]
@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
]
@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"
"\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \\\"-NoExit\\\", \\\"-Command Set-Location -literalPath '%V'\\\" -verb RunAs"

```
页: [1]
查看完整版本: windows添加右键打开cmd和Powershell窗口