header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
How to redirect/catch Console.WriteLine() output ?
Last Post 03 Jan 2010 09:57 PM by madmidi. 0 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
madmidiUser is Offline
New Member
New Member
Posts:1
Avatar

--
03 Jan 2010 09:57 PM
    Dear all

    In my script I load the .NET assembly library "TagLib#", a library to access e.g. mp3-tags.

    If the the importend "Create"-function of this lib fails, it generates two kinds of errors.
    It throws exceptions to PS which I can trap without any problems.
    And it catches own exceptions and uses Console.WriteLine() to write a detailed error message to the console.
    But the return value (.NET Lib.Tag....-object) is always existing and $? is always $true.

    Even "start-transcript" can't log the text from Console.WriteLine() output.

    How can I determine if the function has failed or not ?
    How can I redirect or examine the Console.WriteLine() error messages ?

    I've googled for hours and tried everything...

    I use PS1.0 under Vista and be a newbie to PS.

    TIA
    best regards



    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer