How to avoid Pause due to long output

This topic contains 4 replies, has 2 voices, and was last updated by  Don Jones 1 year, 10 months ago.

  • Author
  • #53113

    nitheesh babu


    This might have been asked many times but I couldnt find the thread.

    If a command is having a very long output powershell simply hangs. Is there a bypass which I can use to avoid it during automation?

    qfarm /load | out-file .\citrixload.txt
    #above is a citrix related command that gives me the entire list of servers and corresponding loads in my citrix farm, it can have 1000 plus line output. 
    #I need this result as a whole, unattended to be supplied to other functions for automation.
    #But due to the length of the result, powershell simply hangs. 
    • This topic was modified 1 year, 10 months ago by  nitheesh babu.
  • #53118

    Don Jones

    No, not easily. In this case, PowerShell is running Cmd.exe to run qfarm, so PowerShell isn't really in control.

    Have you considered running "qfarm > output.txt" in a batch file or something first, to get the output into a file that PowerShell can simply load?

    How large is the output – e.g., if you output it to a file, how large is the file?

  • #53120

    nitheesh babu

    Thanks Don.

    In my case it is a 350 line output. Powershell stops at 300 Lines.

    Even CMD stops at 300 lines.

    if I do qfarm /load > c:\output.txt in CMD, it is getting hung. I have to CTRL+c to exit.

    It only works if I run 'qfarm /load' in CMD. Then it shows the 'Press any key when ready..." and continues if i press Enter.

  • #53122

    nitheesh babu


    I think I got it.

    The command itself have a switch to avoid the page break.

    qfarm /load /continue

  • #53124

    Don Jones

    Perfect :).

You must be logged in to reply to this topic.