Functions vs Filters

PowerShell Team

In my previous entry, I referred to Rsbohn’s blog PowerShell $Profile and his function to slow down output

function slowly ($tempo=100) { process { $_; Start-Sleep -milliseconds $tempo}}

This is a good candidate for a FILTER. A filter is function that just has a process scriptblock. So you could have written his as:

filter slowly ($tempo=100) { $_; Start-Sleep -milliseconds $tempo}


Jeffrey Snover [MSFT]
Windows PowerShell/MMC Architect
Visit the Windows PowerShell Team blog at:
Visit the Windows PowerShell ScriptCenter at:


Discussion is closed.

Feedback usabilla icon