有没有办法从Windows资源管理器启动PowerShell在一个特定的文件夹,例如右键单击一个文件夹,并有一个选项,如“打开PowerShell在这个文件夹”?
每天我第一次运行MSBuild时,都要更改项目文件夹的目录,这真的很烦人。
有没有办法从Windows资源管理器启动PowerShell在一个特定的文件夹,例如右键单击一个文件夹,并有一个选项,如“打开PowerShell在这个文件夹”?
每天我第一次运行MSBuild时,都要更改项目文件夹的目录,这真的很烦人。
当前回答
在Windows 10中,命令提示符和powershell提示符都可以通过菜单栏找到,无论是非管理员用户还是管理员用户。这些选项将其文件夹设置为当前从资源管理器中选择的文件夹。
至少对于瑞典版本,powershell是用Alt F+I打开的。对于管理员powershell,它是Alt F+S+P。
如果这些不是正确的字符,您可以按住Alt键查看正确的字符。每个步骤的菜单项上将覆盖一个字符。
其他回答
如果你使用的是Windows 8或更高版本,你可以简单地使用内置的文件→“打开Windows PowerShell”。
或者Alt + F + R。
您可以从这里下载inf文件-介绍PowerShell提示在这里
通过添加下面的注册表键,在Windows 10中,我成功地在我的SHIFT + RClick上下文菜单中获得了Open PowerShell Here选项。 只需将这些复制到一个空白的记事本文件中,然后保存为.reg文件,并运行该文件来添加密钥,它应该从那里开始工作。 其中一些其他答案说,将密钥添加到HKCR\Directory\shell,但我发现,对我来说,它只适用于进入HKLM\SOFTWARE\Classes\Directory\shell的密钥
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\powershell]
"Extended"=""
"NoWorkingDirectory"=""
@="Open PowerShell here"
"Icon"="%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\powershell\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\powershell]
@="Open PowerShell here"
"Extended"=""
"Icon"="%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"
"NoWorkingDirectory"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\powershell\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"
只有在Windows 10上我才用得到……
创建一个名为PowershellHereContextMenu的文件。reg与下面的内容,右键单击它,并“合并”。
Windows Registry Editor Version 5.00
;
; Add context menu entry to Windows Explorer folders
;
[HKEY_CLASSES_ROOT\Directory\shell\powershellmenu]
@="PowerShell Here"
[HKEY_CLASSES_ROOT\Directory\shell\powershellmenu\command]
@="C:\\\\Windows\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%L'"
;
; Add context menu entry to Windows Explorer background
;
[HKEY_CLASSES_ROOT\Directory\Background\shell\powershellmenu]
@="PowerShell Here"
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\powershellmenu\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"
;
; Add context menu entry to Windows Explorer drive icons
;
[HKEY_CLASSES_ROOT\Drive\shell\powershellmenu]
@="PowerShell Here"
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Drive\shell\powershellmenu\command]
@="C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%V'"
Windows 10让这一切变得简单多了。你可以:
SHIFT +鼠标右键单击一个文件夹,你会得到一个菜单项打开PowerShell窗口。
或者你可以:
File ->打开Windows PowerShell。
作为奖励…
如果您鼠标右键单击文件>打开Windows PowerShell,那么您可以添加到快速访问工具栏:
这里有一个方便的图标:
现在你可以点击那个图标。:)