This blog has moved to http://ThePowerShellGuy.com
Greetings /\/\o\/\/
In the More Replacement in last Post :
Enhanced More Function for MSH, I forgot to close the files opened by the script, as Keith Hill pointed out to me in the NG.
as well as a nice feature request, The Having statement as in C#.
because as you see in the fixes below I need to do it in 3 Places now
as there is no more input to read from the file :
if ($byte -ne -1){[void]$sb.Append([char]$byte)}
Else {
$fs.close();$eof = $True;break}
If you skip to next file :
"F" {
$fs.close();$eof = $true;}
If you Quit.
"Q" {
$fs.close();$eof = $true;$Quit = $true}
and even then if you use Ctrl-C to Exit, you have chance it not gets closed
(I think it's possible to overrule this, will look into that later.)
and a trap should be used to close the file in case of an unforseen error.
when I have worked the mentioned issues out, I post them till then, mentioned changes will solve most cases, and will get you going.
gr /\/\o\/\/