首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何从Windows资源管理器启动PowerShell?

如何从Windows资源管理器启动PowerShell?
EN

Stack Overflow用户
提问于 2008-10-08 17:30:16
回答 18查看 130.9K关注 0票数 287

有没有办法从Windows资源管理器中启动特定文件夹中的PowerShell,例如右键单击文件夹,并有一个类似于“打开此文件夹中的PowerShell”的选项?

每天第一次运行MSBuild时,不得不将目录切换到我的项目文件夹,这真的很烦人。

EN

Stack Overflow用户

发布于 2017-06-24 22:55:44

对于autohotkey用户,这里有一个我正在使用的代码片段

当按下时,它会打开PowerShell窗口Ctrl-Alt-T..。(使用Win10测试)

如果您的“活动窗口”是Windows Explorer -window,则该PowerShell将在

当前文件夹..。否则,只需在某些应用程序中打开PowerShell默认文件夹..。

用法: 1)安装AutoHotkey,然后将其复制粘贴到myscript.ahk中2)替换为您选择的路径。3)运行脚本。

代码语言:javascript
运行
复制
; 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
票数 1
EN
查看全部 18 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/183901

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档