有没有办法从Windows资源管理器中启动特定文件夹中的PowerShell,例如右键单击文件夹,并有一个类似于“打开此文件夹中的PowerShell”的选项?
每天第一次运行MSBuild时,不得不将目录切换到我的项目文件夹,这真的很烦人。
发布于 2017-06-24 22:55:44
当按下时,它会打开PowerShell窗口Ctrl-Alt-T
..。(使用Win10测试)
如果您的“活动窗口”是Windows Explorer -window,则该PowerShell将在
当前文件夹..。否则,只需在某些应用程序中打开PowerShell默认文件夹..。
用法: 1)安装AutoHotkey,然后将其复制粘贴到myscript.ahk中2)替换为您选择的路径。3)运行脚本。
; Ctrl-Alt-T opens PowerShell in the current folder, if using Windows Explorer. Otherwise, just open the Powershell.
^!T::
if WinActive("ahk_class CabinetWClass") and WinActive("ahk_exe explorer.exe")
{
KeyWait Control
KeyWait Alt
Send {Ctrl down}l{Ctrl up}
Send powershell{Enter}
}
else
{
psScript =
(
cd 'C:\'
ls
)
Run "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" -NoExit -Command &{%psScript%}
}
return
https://stackoverflow.com/questions/183901
复制相似问题