有没有办法从Windows资源管理器启动PowerShell在一个特定的文件夹,例如右键单击一个文件夹,并有一个选项,如“打开PowerShell在这个文件夹”?
每天我第一次运行MSBuild时,都要更改项目文件夹的目录,这真的很烦人。
有没有办法从Windows资源管理器启动PowerShell在一个特定的文件夹,例如右键单击一个文件夹,并有一个选项,如“打开PowerShell在这个文件夹”?
每天我第一次运行MSBuild时,都要更改项目文件夹的目录,这真的很烦人。
当前回答
Windows 10让这一切变得简单多了。你可以:
SHIFT +鼠标右键单击一个文件夹,你会得到一个菜单项打开PowerShell窗口。
或者你可以:
File ->打开Windows PowerShell。
作为奖励…
如果您鼠标右键单击文件>打开Windows PowerShell,那么您可以添加到快速访问工具栏:
这里有一个方便的图标:
现在你可以点击那个图标。:)
其他回答
只有在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窗口”,现在你应该已经在使用Windows终端了。
我想让这个上下文菜单只在右键单击并按住“SHIFT”时工作,这是内置的“在这里打开命令窗口”上下文菜单的工作方式。
然而,所提供的解决方案都没有做到这一点,所以我不得不滚动我自己的.reg文件-复制下面的文件,将其保存为power-shell-here-on-shift。Reg并双击它。
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\powershell]
@="Open PowerShell here"
"NoWorkingDirectory"=""
"Extended"=""
[HKEY_CLASSES_ROOT\Directory\shell\powershell\command]
@="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%L'"
有一个Windows资源管理器扩展是由一个为SVN制作工具的家伙做的,它至少会打开一个命令提示窗口。
我还没有尝试过,所以我不知道它是否能做PowerShell,但我想与Stack Overflow的兄弟们分享我的爱:
http://tools.tortoisesvn.net/StExBar
Windows 10让这一切变得简单多了。你可以:
SHIFT +鼠标右键单击一个文件夹,你会得到一个菜单项打开PowerShell窗口。
或者你可以:
File ->打开Windows PowerShell。
作为奖励…
如果您鼠标右键单击文件>打开Windows PowerShell,那么您可以添加到快速访问工具栏:
这里有一个方便的图标:
现在你可以点击那个图标。:)