In a previous post I described a PowerShell script that I created for renaming image files.  The other day I mistakenly put in an incorrect value for one of the command line parameters.  At that point I realized that maybe my script needed the same capability that many of the PowerShell cmdlets have.  It is a parameter called "whatIf".

whatIf is a parameter that cmdlets with a destructive nature make available in order to allow you to verify that your script will work as you intended before committing any changes.

So I gave my script an optional command line parameter of the same name.  This is then conditionally added to the rename-item command so that I can review how my files will be renamed.  It is a simple change that will hopefully avoid a lot of headaches.