Important: Please read the Qt Code of Conduct -

Emulating cmd.exe or other native terminal in Qt

  • I'm trying to begin research on implementing a custom command console for the native system with Qt. I would like to write an advanced cmd.exe (for Windows), and possibly have it cross platform as a Terminal replacement for OSX, etc.
    Does anyone have any tips or links to resources I might check out to get underway?

    In my initial experimentation, I've just subclassed a QPlainTextEdit widget, and am capturing the current command and trying to send it through to a QProcess, however, I'm not sure that this is the right direction to go. Is there a better approach?
    I believe I could also experiment with writing a Qt Console application, and having a GUI on top of it.
    My main thought block is if either of these solutions would be able to execute any command as if it were its own native system terminal or command console, for the underlying operating system. ie. if I wanted to open a telnet connection within this application, I should just have to enter 'telnet <host>' and it should stream all the output from that connection.
    Is there a straightforward way to accomplish this, or will it involve a lot of complex customization based on any command I wanted to support?

    Thanks for any guidance!

  • I'm not quite shure what you want to achieve but if you're trying to implement a Windows console from the scratch i think this isn't possible because of lacking low level system functionality.

    But for a Windows console application you may have a look at this project:
    They hook into a hidden cmd.exe (-or other shells) and forward the commands to this processes.


  • I don't get it: Do you want to build a terminal emulator or a command-line interface?

Log in to reply