Streaming Output to Console

Welcome Forums General PowerShell Q&A Streaming Output to Console

Viewing 1 reply thread
  • Author
    Posts
    • #239579
      Participant
      Topics: 6
      Replies: 17
      Points: 132
      Helping Hand
      Rank: Participant

      Just for fun, I thought it’d be cool to track the price of bitcoin using powershell (my boss is still into it). I found an API that returns everything I want using JSON format – and that works perfectly fine — have a look below if you’d like to replicate. My problem is, if I want to make it a “live ticker” – so to speak – I’m expecting to do something like Do {Get-BitcoinValue; Start-Sleep -Sec 60 } while ($true) however, the first Get-BitcoinValue doesn’t display anything… then after 60 seconds, I get the first and second results at the same time, then every 60 seconds a new “row” is added. I feel like this is something to do with how powershell handles streaming output to the host, but I have no idea how to workaround that. Curious if anyone has any thoughts.

      And if you’re curious about the default view:

    • #239582
      Participant
      Topics: 6
      Replies: 17
      Points: 132
      Helping Hand
      Rank: Participant

      Just realized, I could probably just make a Timer object, and attach Get-BitCoinValue to the “elapsed” event… I should give that a shot…

Viewing 1 reply thread
  • You must be logged in to reply to this topic.