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

Advertisements
This entry was posted in Powershell, Scripting Games. Bookmark the permalink.

One Response to Scripting Games–major dislike #2

  1. Jon says:

    You should consider changing the tagline of your blog to “Backticks are bad!!!” 🙂

    PS. I agree with you. I hate the backticks too.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s