When I have to parse command line options, I always look if there is something like getopts, getopt or something similar. It makes paring so very much simpler.
Zend PHP Framework has getopts, bash has it built in; and I am sure there are many free libraries or builtins for many projects, frameworks, and shells.
Sadly, I do not know of such a tool for Powershell, but it would surprise me if you couldn't find a getopt-like thingie for it.
If there is no getopts I try to make someone else code the command line script, because I think it is just too much hassle to reinvent the wheel (of of command line parsing) all over again.