I added a limit to what is put into the edit control as it can only do 30000 characters and then accepts no more. So, only approximately last 15000 is kept. Added CLS to clear the edit control. Added $tail variable to keep output of last command as you mention about ping....
Try this and see if it suits your interest.
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <Constants.au3>
#include <GuiEdit.au3>
#include <Misc.au3>
#include <ButtonConstants.au3>
$hGUI = GUICreate("Command Prompt", 600, 326)
$hEdit = GUICtrlCreateEdit('', 0, 0, 600, 297, BitOR($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_WANTRETURN, $ES_READONLY))
GUICtrlSetFont(-1, 10, 400, 0, "Lucida Console")
GUICtrlSetBkColor(-1, 0x000000)
GUICtrlSetColor(-1, 0xFFFFFF)
$Input1 = GUICtrlCreateInput("", 104, 299, 483, 21)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Button1 = GUICtrlCreateButton("Send", 8, 297, 91, 25, $BS_DEFPUSHBUTTON)
GUISetState(@SW_SHOW)
$DOS = Run('"' & @ComSpec & '"', '', @SW_HIDE, $STDERR_MERGED + $STDIN_CHILD)
Global $tail
While ProcessExists($DOS)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
StdInWrite($DOS, 'Exit' & @CRLF)
ProcessWaitClose($DOS)
Case $Button1
; clear screen using cls
Switch GuiCtrlRead($Input1)
Case 'cls'
GUICtrlSetData($hEdit, '')
GUICtrlSetData($Input1, '')
ContinueLoop
EndSwitch
; write in command
StdinWrite($DOS, GuiCtrlRead($Input1) & @CRLF)
; clear input ctrl
GUICtrlSetData($Input1, '')
; clear tail of stdout data
$tail = ''
Case Else
; get output from command
$Stdout = StdoutRead($DOS)
If @extended Then
; add to tail
$tail &= $Stdout
; read edit ctrl
$sEdit = GUICtrlRead($hEdit)
; limit size in edit to prevent reaching full limit
If StringLen($sEdit) > 15000 Then
GUICtrlSetData($hEdit, StringRight($sEdit, 15000))
EndIf
; append stdout to edit ctrl
GUICtrlSetData($hEdit, $Stdout, True)
ElseIf StringRight($tail, 1) = '>' Then
; show out of tail when > is found at the end
MsgBox(0, 'tail', $tail)
$tail = ''
EndIf
EndSwitch
WEnd