title: Replace path in Powershell string
body: <p>in my script I check some files and would like to replace a part of their full path with another string (unc path of the corresponding share).</p>
  
  <p>Example:</p>
  
  <pre><code>$fullpath = "D:\mydir\myfile.txt"
  $path = "D:\mydir"
  $share = "\\myserver\myshare"
  write-host ($fullpath -replace $path, $share)
  </code></pre>
  
  <p>The last line gives me an error since $path does not not contain a valid pattern for regular expressions. </p>
  
  <p>How can I modify the line to make the replace operator handle the content of the variable $path as a literal?</p>
  
  <p>Thanks in advance,
  Kevin</p>