title: Match strings stored in variables using PowerShell
body: <p>I am attempting to create a backup script that will move files that are older that 30 days, but I want to be able to exclude folders from the list</p>
  
  <pre><code>$a = "C:\\Temp\\Exclude\\test"
  $b = "C:\\Temp\\Exclude"
  </code></pre>
  
  <p>if I run the following:</p>
  
  <pre><code>$a -match $b
  </code></pre>
  
  <p>Following <a href="http://www.computerperformance.co.uk/powershell/powershell_conditional_operators.htm#Example_1_-Match" rel="nofollow noreferrer">PowerShell Basics: Conditional Operators -Match -Like -Contains &amp; -In -NotIn</a>:</p>
  
  <pre><code>$Guy ="Guy Thomas 1949"
  $Guy -match "Th"
  </code></pre>
  
  <p>This returns <code>true</code>.</p>