[英]Load script from PowerShell ISE's command environment
Is there a way to open a script file ($profile or otherwise) from within the IDE's command environment ( PS>
prompt), such that it loads in the IDE itself? 有没有一种方法可以从IDE的命令环境(
PS>
提示符)中打开脚本文件($ profile或其他文件),从而将其加载到IDE本身中?
# loads the current user/current host profile in Notepad (probably because .PS1 is associated w/ Notepad.exe)
PS > ii $profile
# same for any random script file
PS > ii .\Foo.ps1
Instead of Invoke-Item
, just use ise
. 代替
Invoke-Item
,只需使用ise
。 When run from the ISE, it will load the file. 从ISE运行时,它将加载文件。
PS> ise myscript.ps1
To make Invoke-Item behave like you want (as well as double-clicking from Explorer), you can associate .ps1 files with powershell_ise.exe
. 要使Invoke-Item表现出所需的行为(以及从资源管理器中双击),可以将.ps1文件与
powershell_ise.exe
关联。 Here is a blog post explaining how to do this if you need it. 这是一篇博客文章, 解释了如何在需要时执行此操作 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.