You can try this in AutoHotkey. Doesn't do even basic things like being able to resize the window but it might work for you. Also, the first input box isn't labeled but it's the working directory to use. After you type a command and hit enter then it will turn on auto-update after that and automatically run on every keystroke thereafter.
;---------------------------------------------------------------------------------------------
; CommandConsole.ahk
;---------------------------------------------------------------------------------------------
Main:
myTitle := "Command Console"
myFont := "Courier New"
myFontSize := "10"
xMargin := 10, yMargin := 10
xSpace := 10, ySpace := 10
txtWidth := 700, butWidth := 100
inputHeight := 20
outputHeight := 600
firstRun := True
immediateExec := False
Gui, Add, Button, x0 y0 w0 h0 default gbutSubmit, ; default button used for grabbing text entry
vertical := yMargin
Gui, Font, % "s" myFontSize, % myFont
Gui, Add, Edit, % "x" xMargin " y" vertical " w" txtWidth " h" inputHeight " vWorkingDir", . ; current directory is default working directory, i.e., "."
Gui, Font
Gui, Add, Button, % "x" xMargin+txtWidth+xSpace " y" vertical " w" butWidth " h" 2*inputHeight+yspace " gButAuto vButCaption", % "Auto-Update`n" . (immediateExec ? "On" : "Off")
vertical += inputHeight + ySpace
Gui, Font, % "s" myFontSize, % myFont
Gui, Add, Edit, % "x" xMargin " y" vertical " w" txtWidth " h" inputHeight " gEditUpdated vtxtInput",
Gui, Font
Gui, Font, % "s" myFontSize, % myFont
vertical += inputHeight + ySpace
Gui, Add, Edit, % "x" xMargin " y" vertical " w" txtWidth+xSpace+butWidth " h" outputHeight " vtxtOutput " ; disabled"
Gui, Font
vertical += OutputHeight+yMargin
Gui, Show, % "w" txtWidth+xSpace+butWidth+2*xMargin " h" vertical, % myTitle
GuiControl, focus, txtInput ; focus on the command input for entry
return
;---------------------------------------------------------------------------------------------
; GuiClose() - Exit app when GUI closes
;---------------------------------------------------------------------------------------------
GuiClose() {
ExitApp
}
;---------------------------------------------------------------------------------------------
; butSubmit() - No-size button to capture Enter keystrokes when auto-update is off
;---------------------------------------------------------------------------------------------
butSubmit() {
global
EnterWasPressed := True
if firstRun and !immediateExec ; set auto-update after the first command is executed if it's not set already
ButAuto()
else
EditUpdated() ; on subsequent
}
;---------------------------------------------------------------------------------------------
; EditUpdated()
;---------------------------------------------------------------------------------------------
EditUpdated() {
global ; easy access to GUI vars
Gui, Submit, NoHide
;tooltip Edit was updated: %txtInput%
if immediateExec or EnterWasPressed {
guiControl,, txtOutput, % RunWaitOneB(txtInput, WorkingDir)
EnterWasPressed := False
}
lasttxtInput := txtInput
Gui, Submit, NoHide
if (txtInput<>lastTxtInput)
setTimer, EditUpdated, -1
return
}
;---------------------------------------------------------------------------------------------
; ButGo() - Called every time the user clicks auto-execute True/False Button
;---------------------------------------------------------------------------------------------
ButAuto() {
global
immediateExec := !immediateExec
guiControl,, butCaption, % "Auto-Update`n" . (immediateExec ? "On" : "Off")
if immediateExec
EditUpdated()
}
;---------------------------------------------------------------------------------------------
; RunWaitOne() - From AutoHotkey Help for RunWait (has annoying command prompt flash up)
;---------------------------------------------------------------------------------------------
RunWaitOne(command) {
shell := ComObjCreate("WScript.Shell") ; WshShell object: http://msdn.microsoft.com/en-us/library/aew9yb99
exec := shell.Exec(ComSpec " /C " command) ; Execute a single command via cmd.exe
return exec.StdOut.ReadAll() ; Read and return the command's output
}
;---------------------------------------------------------------------------------------------
; RunWaitOneB() - Get stdout by writing to a temp file vs. reading the buffer
;---------------------------------------------------------------------------------------------
RunWaitOneB(command, WorkingDir:=".") {
tmpFile := A_Temp . "\temp.txt"
FileDelete, %tmpFile%
RunWait, %comspec% /c %command% > %tmpFile%, %WorkingDir%, Hide
FileRead, output, %tmpFile%
return output
}
When you say you want the output to be live, would it be acceptable if the output was shown only after each command was executed in full? In other words, if you look at RunWait documentation for AutoHotkey it can do this and grab the output after each command, but if you were to do a dir/s on your entire harddisk I don't think it would have any output until a half-hour later when the command completed, unlike a regular command prompt which would show the output scrolling. – JJohnston2 – 2016-03-05T22:43:29.013
What are you trying to accomplish with an input and an output window? Trying to re-execute variations of a command? Would you clear the output window each time a new command is executed such that the output window only shows the output for the last command executed? – JJohnston2 – 2016-03-05T22:45:23.357
Answered your questions by editing question. – gyaani_guy – 2016-03-07T05:12:17.033