Powershell, multi line txt file variables
<p>I have a text file with hostnames on individual lines:</p>

<pre><code>IT4524
IT5135
IT5688
... etc
</code></pre>

<p>I can import these and list each individual line:</p>

<pre><code>$hostname[1]
IT4524
</code></pre>

<p>I need to pipe each (and all) individual lines through a command. How can I do this without having to write:</p>

<pre><code>  If "\\$hostname[1]\c$\test.txt{
      # // File exists
    }Else{
      # // File does not exist
    }

  If "\\$hostname[2]\c$\test.txt{
      # // File exists
    }Else{
      # // File does not exist
    }
</code></pre>

<p>... ETC</p>

<p>The end result is to check each hostnames C: for a txt file outputted by another PS</p>

<p>Hope I have explained this well enough</p>