#include Local $cmd = Run("cmd.exe", @ScriptDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) ;~ Sleep(1000) local $text = "Hello" local $number = 1 Hotkeyset("{pause}", hotkeyTest) while 1 sleep(100) wend func hotkeyTest() sendEcho($text & $number) $number += 1 EndFunc StdinWrite($cmd) ConsoleWrite("END" & @CRLF) func sendEcho($text) ;build the command $command = "echo " & $text & @CRLF ConsoleWrite("COMMAND: " & $command & @CRLF) ; debug check ;send command to the console StdinWrite($cmd, $command) $line = "" ;loops and gathers all the command output While True $line &= StdoutRead($cmd) ConsoleWrite($line) ;debug If @error Then ExitLoop ;to exit the while loop we look for the blank command prompt, the trimming is needed to get a clean match. If StringRight($line,StringLen(@ScriptDir) + 1) = @ScriptDir & ">" Then ExitLoop Sleep(30) WEnd EndFunc