Categories

Scripting Games–major dislike #2

I’ve already blogged about incorrect use of backticks.  Here is another example of un-necessary use of backticks

$Files= Get-ChildItem `
        -Path $Path `
        -include $Type `
        -Recurse `
        -File |
Where-Object {$_.LastWriteTime -lt (get-date).AddDays(-$OlderThan) }

Spreading out one parameter per line like this doesn’t add anything to the script and makes working on the get-childitem cmdlet code harder if you want to change it.

Don’t do this

Leave a Reply