title: New pin to quick access in file Explorer from a file
body: <p>Has a script that makes new pin to quick access in file Explorer from a file</p>
  
  <p>Here is the script:</p>
  
  <pre><code>#New pin to quick access in file Explorer from a file
  $ShortcutsFile = 'H:\_ProfilBackup\Genveje.txt'
  $listFile = Get-Content $ShortcutsFile
  
  $o = new-object -com shell.application -Verbose
  
  foreach ($line in Get-Content $ShortcutsFile) {
      if ($line -match $regex) {
          $o.Namespace($line).Self.InvokeVerb("pintohome")
      }
  }
  </code></pre>
  
  <p>Can anyone explain why it works?</p>
  
  <p>I'm a little confused about the line:</p>
  
  <pre><code>foreach ($line in Get-Content $ShortcutsFile) {
  if ($line -match $regex)
  </code></pre>
  
  <p>Have tried other ways to read the content from a file. </p>
  
  <p>But then it only works if there is only one line in the file.</p>
  
  <p>I can only make it work with multiple lines from a file if I use the above script</p>