title: Test-Path - Variable Part of FileName - Variable doesn't get substituted
body: <p>SourceFile.txt has the below</p>
  
  <pre><code>&lt;somepath&gt;\filename_$tminus1.csv
  </code></pre>
  
  <p>The below is the script I've written.</p>
  
  <pre><code>$date = [DateTime]::ParseExact("21-Aug-18", "dd-MMM-yy", $null)
  
  if ($date.DayOfWeek -eq "Monday") {
      $tminus1 = $date.AddDays(-3).ToString('yyyyMMdd')
      $tminus2 = $date.AddDays(-4).ToString('yyyyMMdd')
      Write-Host "Date vaulues set for Monday"
  } else {
      $tminus1 = $date.AddDays(-1).ToString('yyyyMMdd')
      $tminus2 = $date.AddDays(-2).ToString('yyyyMMdd')
      Write-Host "Date vaulues set for Non-Monday"
  }
  
  $files = Get-Content -Path $PSScriptRoot\SourceFile.txt
  
  foreach ($file in $files) {
      Convert-Path $file
  
      if (-not (Test-Path $file)) {
          echo ""
          Write-Host "$file doesn't exist"
      } else {
          echo ""
          Write-Host "$file exists"
      }
  }
  </code></pre>
  
  <p>The <code>Test-Path</code> cmdlet doesn't get the variable value substituted while looking for the file. It prints the below.</p>
  
  <pre><code>&lt;somepath&gt;\filename_$tminus1.csv doesn't exist
  </code></pre>
  
  <p>I expect the <code>$tminus1</code> value gets substituted as 20180823 so that the else part prints the below.</p>
  
  <pre><code>&lt;somepath&gt;\filename_$tminus1.csv exists
  </code></pre>