PowerShell: You must think in objects

Yes, Firefox (“You must think in Russian”) is one of my favorite movies 🙂

Even now, I still find myself thinking cmd-ish at times and forgetting how much easier life is in PowerShell.

An example from yesterday was doing a dir -r -filter to look for a set of files in a tree.  Then I realized I wanted to delete all of them.  My knee-jerk brain reaction (too much cmd.exe time) was along the lines of doing a for loop with “dir /s /b”.  Then I remembered – oh, yeah, these are real objects – just pipe the output to remove-item and be done with it.

Dealing with real objects all the time is a great shift, but I still find myself trying to remember the power that’s available – it makes a lot of things much easier, but only if you remember you’re holding the keys to the Ferrari in the first place. 🙂