title: Performing A String Operation in a -replace Expression
body: <p>I'm trying to make using of String.Substring() to replace every string with its  substring from a certain position. I'm having a hard time figuring out the right syntax for this.</p>
  
  <pre><code>$dirs = Get-ChildItem -Recurse $path | Format-Table -AutoSize -HideTableHeaders -Property @{n='Mode';e={$_.Mode};width=50}, @{n='LastWriteTime';e={$_.LastWriteTime};width=50}, @{n='Length';e={$_.Length};width=50}, @{n='Name';e={$_.FullName -replace "(.:.*)", "*($(str($($_.FullName)).Substring(4)))*"}} | Out-String -Width 40960
  </code></pre>
  
  <p>I'm referring to the following expression</p>
  
  <pre><code>e={$_.FullName -replace "(.:.*)", "*($(str($($_.FullName)).Substring(4)))*"}}
  </code></pre>
  
  <p>The substring from the 4th character isn't replacing the Full Name of the path.
  The paths in question are longer than 4 characters.</p>
  
  <p>The output is just empty for the Full Name when I run the script.
  Can someone please help me out with the syntax</p>
  
  <p><strong>EDIT</strong>
  The unaltered list of strings (as <code>Get-ChildItem</code> recurses) would be </p>
  
  <pre>
  D:\this\is\where\it\starts
  D:\this\is\where\it\starts\dir1\file1
  D:\this\is\where\it\starts\dir1\file2
  D:\this\is\where\it\starts\dir1\file3
  D:\this\is\where\it\starts\dir1\dir2\file1
  </pre>
  
  <p>The <code>$_.FullName</code> will therefore take on the value of each of the strings listed above.
  Given an input like <em>D:\this\is</em> or <em>D:\this\is\where</em>, then I'm computing the length of this input (including the delimiter <code>\</code>) and then replacing <code>$_.FullName</code> with a substring beginning from the nth position where <em>n</em> is the length of the input.</p>
  
  <p>If input is D:\this\is, then length is 10.
  Expected output is </p>
  
  <pre>
  \where\it\starts
  \where\it\starts\dir1\file1
  \where\it\starts\dir1\file2
  \where\it\starts\dir1\file3
  \it\starts\dir1\dir2\file1
  </pre>