在打开目录时打开 Powershell 的技巧?

在打开目录时打开 Powershell 的技巧?

如果您在窗口的地址栏中输入“cmd”,则会在该目录中打开命令行。有没有办法对 powershell 执行相同的操作,从而节省您导航到文件表的某个深处的时间?

答案1

我已将 PowerShell 添加到我的 shell 中,因此如果我右键单击文件夹或文件夹的背景,我就会得到“在此处打开 PowerShell”选项,该选项会在选定的或当前的目录中打开 PowerShell。

只需添加以下注册表项:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\powershell]
@="Open PowerShell Here"

[HKEY_CLASSES_ROOT\Directory\Background\shell\powershell\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"

[HKEY_CLASSES_ROOT\Directory\shell\powershell]
@="Open PowerShell Here"

[HKEY_CLASSES_ROOT\Directory\shell\powershell\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%L'"

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\powershell\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"

应该能够将上述内容粘贴到文本文件中并将扩展名更改为 .reg 并导入它。

相关内容