One of the commands I've found more useful in PowerShell is the resolve-path command, which "interprets the wildcard characters in a path and displays the items and containers at the location specified by the path, such as the files and folders or registry keys and subkeys. The names appear just as they are represented in the drive, including capitalization".

It's the first part of the description states what I found to be most useful about it. Here's an example: I keep a Tools folder around in my E:\ drive which contains a large and assorted set of tools and executables I use everyday. Everything in this folder is stuff I can simply copy over to another machine and it will work right away, meaning that I don't need to care about installing or synchronizing any of them when I switch machines.

This folder also includes a few open source tools, like NUnit, NAnt or Subversion, which are updated every once in a while. I don't care about keeping multiple version of them around, but I do care about knowing which version I have in my system so that I can easily check if updates are available. For example, I might keep SVN in "$Tools\svn-win32-1.4.2\".

The last thing I want, however, is to have to keep updating my profile and other scripts where I use SVN so that the path matches the folder I have it installed with. With PowerShell, however, I can simply do stuff like this:

append-path (resolve-path "$TOOLS\svn-*\bin")
append-path (resolve-path "$TOOLS\nant-*")

Here, I'm simply adding these folders to my path. If I download a new version of the tools, I can simply install it in it's own named folder (with the version number) and delete the old one, and my scripts (and my PATH!) will still be valid thanks to Resolve-Path. Sweet!

Technorati tags:

Tomas Restrepo

Software developer located in Colombia.