从 PowerShell ISE 的命令环境加载脚本
Load script from PowerShell ISE's command environment
有没有办法从 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
而不是 Invoke-Item
,只需使用 ise
。当来自 ISE 运行 时,它将加载文件。
PS> ise myscript.ps1
要使 Invoke-Item 的行为如您所愿(以及从资源管理器中双击),您可以将 .ps1 文件与 powershell_ise.exe
相关联。这里有一个博客postexplaining how to do this如果你需要的话。
有没有办法从 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
而不是 Invoke-Item
,只需使用 ise
。当来自 ISE 运行 时,它将加载文件。
PS> ise myscript.ps1
要使 Invoke-Item 的行为如您所愿(以及从资源管理器中双击),您可以将 .ps1 文件与 powershell_ise.exe
相关联。这里有一个博客postexplaining how to do this如果你需要的话。