function Test-PathsAreEqual { <# .SYNOPSIS Verify two paths are the same .PARAMETER Path The source path to compare against .PARAMETER Target The target path to compare to #> [CmdletBinding()] [OutputType([bool])] param ( [Parameter(Mandatory = $true, Position = 0)] [ValidateNotNullOrEmpty()] [Alias('From','Source')] $Path, [Parameter(Mandatory = $true, Position = 1)] [ValidateNotNullOrEmpty()] [Alias('To')] $Target ) # Do not do a test-path because they may not exist. # We may be creating a file or something $Target = (Join-Path $Target '') $Path = (Join-Path $Path '') return $Target -eq $Path }