title: Powershell select-string substring
body: <p>I am currently reading the contents of a file and returning a pattern which gets one line. I am able to get the correct line by itself now. How do I do a substring function on the $RunTimeLine result to return the first four characters?</p>
  
  <pre><code>[string] $RunTimeLine = Select-String -Path $IDCSwiftFlowXMLFile -pattern "&lt;time&gt;" | ForEach-Object {$_.Line}
  </code></pre>
  
  <p>OUTPUT of $RunTimeLine  >>>>>>>   30 5 * * 2-6 2 </p>
  
  <p>I have attempted doing the following but it isn't returning anything</p>
  
  <pre><code>$StartTime = $RunTimeLine.substring(0,4)
  </code></pre>
  
  <p>Any help is greatly appreciated. Thanks.</p>