Until PowerShell ISE gets PowerGUI’s “Open Profile” feature…
I hate to admit it, but the convenience of having PowerShell ISE installed with the core installation of PowerShell 2.0 has been enough to get me to switch from PowerGUI, which is in my opinion a much more full featured free editor/debugger.
One thing that I sorely missed from PowerGUI (which is compounded by the fact that unless you’re on Windows 7, PowerShell ISE doesn’t have a "Recent Files" menu) is the ability to quickly open my profile script without having to browse for it.
Well PowerShell ISE is extensible, so if it lacks a feature, you can just add it in most cases. I’ve uploaded my PowerShell ISE profile which has some useful functions for automating the ISE. But the one in particular that implements the "Open Profile" feature is called….(wait for it)…. Open-Profile!
So you can type that in the immediate window, or use the custom menu item that gets added. It opens the user/global/host/generic/etc profiles if they exist.
function Open-File([String]$Path,[Switch]$Quiet) { $AllowedExtensions = @('.ps1','.psm1','.psd1','.ps1xml','.txt','.txt') $Extension = [System.IO.Path]::GetExtension($Path) try { if ( -not ($AllowedExtensions -contains $Extension) ) { throw "OpenFile: $Path cannot be opened in PowerShell ISE." } if ( -not (Test-Path $Path) ) { throw "OpenFile: $Path does not exist." } $Path = (Resolve-Path $Path).ProviderPath $PSISE.CurrentOpenedRunspace.OpenedFiles.Add($Path) } catch { if ( -not $Quiet ) { Write-Warning $_ } } } function Open-Profile { Open-File $PROFILE.CurrentUserAllHosts -Quiet Open-File $PROFILE.CurrentUserCurrentHost -Quiet Open-File $PROFILE.AllUsersAllHosts -Quiet Open-File $PROFILE.AllUsersCurrentHost -Quiet }
In my opinion, the PowerShell ISE is inferior to PowerGUI for a variety of reasons. One of those reasons is the lack of the variable browser pane, which PowerGUI features. This is a very nice debugging benefit of the PowerGUI IDE.-Trevor Sullivan