Foreach blank lines

by O.Ferre at 2012-12-17 02:21:38

I try to write a script to shutdown computers from a list

example :
foreach($pc in $liste)
shutdown -s -m \$pc -c "Shutdown -n Shutdown&quot; -f -t 100<br> }<br></code><br>But, sometimes, there is a blank line in the file $liste, so the local computer shutdown.<br>is there a way to continue if the line is blank <br><code>if ($pc -eq $null) <br>continue</code><br><br>thanks a lot <br>O.F</blockquote>by MattG at 2012-12-17 04:35:06<blockquote>You could simply check that the line is not null and shutdown accordingly:<br><code>foreach&#40;$pc in $liste&#41;<br>{<br> if &#40;$pc&#41;<br> {<br> shutdown -s -m \\$pc -c &quot;Shutdown -n Shutdown" -f -t 100