Get-World | ConvertTo-PowerShell
ISE: Run current line without selecting, AKA v3 feature
I like one of new PowerShell v3 features. When you are in ISE and want to run current line, just press F8, it’s no more necessary to select the line and then use Run Selection (F8). I’d like to have it in v2 also so I created another quick function:
function RunLine { $editor = $psISE.CurrentFile.Editor $currentLine = $editor.CaretLine $currentLineLength = $editor.GetLineLength($currentLine) $currentPosition = $editor.CaretColumn $psISE.CurrentFile.Editor.Select( $currentLine, 1, $currentLine, $currentLineLength + 1 ) "Running >> $($psISE.CurrentFile.Editor.SelectedText)" Invoke-Expression $psISE.CurrentFile.Editor.SelectedText $psISE.CurrentFile.Editor.Select( $currentLine, $currentPosition, $currentLine, $currentPosition ) } $makovecRoot = $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add("Makovec", $null, $null) $makovecRoot.Submenus.Add('Run line',{RunLine},'CTRL+F8') | Out-Null
It allows me to be at some line and by pressing Ctrl+F8 just run it:

If you want to see another cool new features in ISE v3, go to Windows Management Framework 3.0 CTP2 page and download document named Windows PowerShell ISE.pdf.
| Print article | This entry was posted by makovec on 01/01/2012 at 14:19, and is filed under PowerShell. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
