PowerShell控制台和PowerShell ISE之间的区别

dan*_*mad 21 powershell powershell-3.0

PowerShell控制台和PowerShell ISE之间有什么区别.我在PowerShell中的Profiles上下文中询问了这个问题.因为PowerShell控制台和PowerShell ISE都具有不同的配置文件.

Rah*_*thi 15

ISE和PowerShell控制台之间的差异: -

  1. 对交互式控制台应用程序的支持有限,请尝试cmd.exe,然后尝试cmd.exe/k

    a)cmd.exe/c目录仍然可以使用,更多信息可以在这里找到 http://blogs.msdn.com/powershell/archive/2009/02/04/console-application-non-support-in-the- ise.aspx

  2. 控制台应用输出并不丰富多彩

  3. STA默认情况下

    a)尝试$ host.Runspace.ApartmentState

    b)powershell默认为MTA(ApartmentState显示为Unknown),但可以使用powershell -sta以sta模式启动.

    c)ISE始终是STA

  4. 不支持[Console]类,请尝试[console] :: BackgroundColor ='white'.

    a)通常,脚本应该使用主机API(写主机,而不是[Console]类,以便它们在控制台,ISE,远程处理和其他shell中工作.

  5. $ host.UI.RawUI上的限制(接近零)支持.我们只支持颜色和标题

    a)颜色在$ psISE.Options中设置得更好,因为你可以将它们设置为任何颜色,而不仅仅是控制台颜色

  6. 定制/死亡简单更多.请参阅gc功能:更多

    a)ISE没有寻呼机

  7. Start-Transcript在ISE中不起作用

  8. 一些线程文化差异

    a)如果您处于非控制台支持的文化(例如阿拉伯语)中,ISE将具有Get-Culture作为ar-sa,powershell.exe将具有Get-Culture作为en-us(或其他一些后备)

  9. 建议不在ISE中工作

    a)例如,在C:\ Program Files\Internet Explorer中"如果执行iexplore.exe

    b)你只会在PowerShell.exe建议中看到这个[3,常规]:找不到命令iexplore.exe,但确实存在于当前位置.默认情况下,Windows PowerShe ll不会从当前位置加载命令.如果您信任此命令,请键入".\ iexplore.exe".

    有关详细信息,请参阅"get-help about_Command_Precedence".

  10. ISE运行不同的配置文件

    a)ISE配置文件位于Microsoft.PowerShellISE_profile.ps1中,powershell位于Microsoft.PowerShell_profile.ps1中

    b)http://msdn.microsoft.com/en-us/library/bb613488(VS.85 ) .aspx

    c) http://www.leeholmes.com/blog/TheStoryBehindTheNamingAndLocationOfPowerShellProfiles.aspx

    d)您可以使用存储在$ profile.CurrentUserAllHosts中的公共配置文件使其在两个shell中运行

  11. 只有ISE有$ psISE

    a)它可以访问http://psisecream.codeplex.com/,以及http://blogs.msdn.com/powershell/archive/2008/12/29/powershell-ise-can-do-a-lot-更比你-think.aspx

  • 实际上,PowerShell控制台已恢复为STA的V3和V4的默认值.使用MTA的唯一版本的PowerShell控制台是V2.FWIW*每个*主机,包括Visual Studio中的ISE和NuGet,都有自己的配置文件脚本,使用户有机会进行主机特定的初始化和配置.profile.ps1文件对所有主机都是全局的.尝试执行`$ profile | fl -Force`. (3认同)