title: Validate parameter value using another parameter value
body: <p>I'm trying to validate whether a path exists before running a function.
  There is no default for the folder path, but the file name default should be <code>template.csv</code>. Is there a way, through the ValidateScript attribute, to validate a parameter value based on another parameter value?</p>
  
  <p>The below code returns the error that the variable $TemplateDir has not been set. I'm also not entirely sure if it would test for the default file name value.</p>
  
  <pre><code>function get-Template {   
      [CmdletBinding()]
      Param (
          [Parameter(Mandatory = $true, Position = 0)]
          [ValidateScript({Test-Path $_})]
          [string]$TemplateDir,
  
          [Parameter(Mandatory = $false)]
          [ValidateScript({Test-Path ($TemplateDir + "\" + $_)})]
          [string]$TemplateFile = "template.csv"
      )
  
      ...
  
  }
  </code></pre>
  
  <p>Any advice?</p>