title: Get-Content command Powershell understanding
body: <p>I am trying to figure out as why these commands are not running via script. But when I run this manually it's working.</p>
  
  <pre><code>$value = Get-Content c:\info.txt | select-string Id | Foreach-Object { $_.ToString().split(':')[1] -replace '\s','' } 
  Write-Host "$value" &gt;&gt; c:\list.txt
  </code></pre>
  
  <p>I have tried to redirect out using >> but still there is no information gets updated in variable $value </p>
  
  <pre><code>Get-Content c:\info.txt | select-string Id | Foreach-Object { $_.ToString().split(':')[1] -replace '\s','' } &gt;&gt; $value
      Write-Host "$value" &gt;&gt; c:\list.txt
  </code></pre>