Browsing the archives for the ise tag.


PowerShell 2.0 “More” command in the ISE

Software

Back in the good old days of the DOS command prompt, you frequently wanted to break up a large chunk of results into pages, that you could scroll through using the spacebar.

For example:

help | more

Would show one page of help information at a time.

Does PowerShell 2.0 support the “more” command? Well, it depends.  It depends on if you’re using the “standard” PowerShell.exe command prompt, or the PowerShell_ISE.exe (Integrated Scripting Environment).  The behavior is different depending on which tool you use.

I use the ISE quite a bit.  It’s not a perfect editor – far from it – but I like the ability to have files open and to be able to interactively run parts of scripts via the F8 “run selection” option.

However, in PowerShell ISE, all of the “more” business goes away.  PowerShell ISE doesn’t do a good job of interactively working with results.

So, for example, in PowerShell ISE, if you type:

mysql –? | more

… you won’t get any paging.  Everything will just spit out to the end.

PowerShell has a cmdlet called Out-Host with a –Paging parameter, which theoretically should give us something, but in my tests it just hangs the ISE IDE.  Even the example given in Get-Help Out-Host:

get-process | out-host –paging

Returns with the error:

image

out-lineoutput : The method or operation is not implemented.

So, moral: if you want to do interactive stuff with PowerShell, such as FTP, MySQL, or pipe to “more” to page results, use the standard PowerShell 2.0 command prompt, and stay away from the ISE. For now.

1 Comment

Excellent PowerShell ISE functions

Software

If you’re looking for a good set of prebuilt functions with which to extend your PowerShell v2 ISE environment, check out this excellent collection of PowerShell file, function, and module functions by Josh Einstein. It includes:

Open-File (opens a file in the ISE editor)
Open-Profile (opens your profile(s) in the ISE editor)
Open-Module
Open-Function
Close-File

http://einsteintech.spaces.live.com/Blog/cns!89E05724AF67A39E!724.entry?wa=wsignin1.0&sa=177582322

No Comments