How to avoid Pause due to long output


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. 

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?

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.


I think I got it.

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

qfarm /load /continue

Perfect :).