//cmdoutput ping localhost >ping.txt | run ping.txt
//cmdoutput netstat -n >netstat.txt

Syntax for ping.exe:
  • ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
    [-r count] [-s count] [[-j host-list] | [-k host-list]]
    [-w timeout] destination-list


    Pings the specified host until stopped.
    To see statistics and continue - type Control-Break;
    To stop - type Control-C.

    -a Resolve addresses to hostnames.
    -n count Number of echo requests to send.
    -l size Send buffer size.
    -f Set Don't Fragment flag in packet.
    -i TTL Time To Live.
    -v TOS Type Of Service.
    -r count Record route for count hops.
    -s count Timestamp for count hops.
    -j host-list Loose source route along host-list.
    -k host-list Strict source route along host-list.
    -w timeout Timeout in milliseconds to wait for each reply.

I put the signal there, that will notify you when the command has finished processing. It runs a synchrounous call, which means the cmdoutput alias waits with processing until the com call returns.

As you can see you can export the results to a text file, which you can then manipulate, read, etc.


//window -n @netstat | cmdoutput netstat -n >netstat.txt | loadbuf @netstat netstat.txt | .remove netstat.txt

alias cmdoutput {
  var %wsh = wsh $+ $ticks
  .comopen %wsh wscript.shell
  .comclose %wsh $com(%wsh,run,1,bstr*,% $+ comspec% /c $1-,uint,0,bool,true)
  .signal cmdoutput $1-
 [color:red]  [/color] 
on *:signal:cmdoutput:{
  echo -ac info * /cmdoutput: finished processing command: $1-