Running EXE's

  • I'm not sure where little helps and tidbits of knowledge goes in the forum. I have had lots of problems recently on getting some exe files to actually run in QT. Through searching the internet and asking around, I have seen 3 different ways to do it, so I thought I would share, just in case someone else ran across any issues on running programs through QT.

    I'm sure this is basic for many people, but having a post like this would of helped me out tremendously when I started. It took like 3 days of almost non stop searching to come up with these ways of working with exe programs. Strange that one way doesn't work, so you have to do it another way, and if that doesn't work, then another way. But, in the end... ONE of these ways will work with ANY exe file that you are wanting to work, so hope it helps someone, and sorry if it's on the wrong section.

    I've found out there are about 3 different ways to run exe programs. When one doesn't work, the other 2 will lol. At least one of them will anyway. Since I'm here, I'll list the four different ways that I've found for others that may have any similar issues:

    1.  QDesktopServices::openUrl(QUrl("file:///C:/windows/notepad", QUrl::TolerantMode));
    2.  system("C:/WINDOWS/system32/osk.exe");
    3.  QProcess::startDetached("\"C:\\Program Files\\WinHTTrack\\WinHTTrack.exe\"");

    You can also use the shell command to open certain windows as well

        system("%windir%/explorer.exe shell:::{4234d49b-0245-4df3-b780-3893943456e1}");

    The above will open Applications, which will show every program/application you have on your computer.

    Or the recycling Bin:

        system("explorer.exe shell:RecycleBinFolder");

    Or as another example, your internet trouble shooting:

        system("msdt.exe -id NetworkDiagnosticsWeb");

    Or you may want to run a DVD using VLC?

    QProcess::startDetached("\"C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe\" H:\\Movies\\Harry_Potter_Year_2\\Chamber_Of_Secrets\\VIDEO_TS.IFO\"");

  • If it's helpful, here is a list of commonly used System Programs for Windows 10

    Command Prompt


    Control Panel



        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/Magnify.exe", QUrl::TolerantMode));

    Registry Edit

        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/regedt32.exe", QUrl::TolerantMode));


        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/services.msc", QUrl::TolerantMode));

    System Info

        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/msinfo32.exe", QUrl::TolerantMode));


        QDesktopServices::openUrl(QUrl("file:///C:/settings", QUrl::TolerantMode));



    Task Manager

        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/Taskmgr.exe", QUrl::TolerantMode));

    Disk Cleanup




    Windows Remote

        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/msra.exe", QUrl::TolerantMode));

    Resource Monitor


    System Repair Discs


    Memory Diagnostics

        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/MdSched.exe", QUrl::TolerantMode));

    System Restore

        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/rstrui.exe", QUrl::TolerantMode));

    Startup Folder

        QDesktopServices::openUrl(QUrl("file:///C:/Users/dclar.DESKTOP-JTNNAGR/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup", QUrl::TolerantMode));

    Run Command

        system("c:/windows/system32/rundll32.exe shell32.dll,#61");

    Drive Optimization


    Disk Managment


    Computer Managment

        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/CompMgmtLauncher.exe", QUrl::TolerantMode));

    Text Tuner


    Computer Services

        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/dcomcnfg.exe", QUrl::TolerantMode));

    Device Manager

        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/devmgmt.msc", QUrl::TolerantMode));

    Direct X Diagnostics


    File History


    Blue Tooth Transfer


    Add Hardware

        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/hdwwiz.exe", QUrl::TolerantMode));

    Disc Label


    Language Installer


    Malicious Software remover



        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/Narrator.exe", QUrl::TolerantMode));

    User Accounts

        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/Netplwiz.exe", QUrl::TolerantMode));

    Windows Backup

        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/sdclt.exe", QUrl::TolerantMode));

    Create Shared Folders

        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/shrpubw.exe", QUrl::TolerantMode));

    System Shutdown

        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/shutdown.exe", QUrl::TolerantMode));

    Sticky Notes


    System Reset

        QDesktopServices::openUrl(QUrl("file:///C:/Windows/System32/systemreset.exe", QUrl::TolerantMode));

    Ease Of Access


    Word Pad


  • Qt Champions 2018

    @Epiales666 said in Running EXE's:

    1. QString cmd = QString(""C:\Program Files (x86)\Notepad++\notepad++.exe"");

    This does not start any executable, it just creates a string variable containing a path to an executable.
    To avoid escaping of backslashes you can use / in Qt even on Windows:

    QString cmd = QString("\"C:/Program Files (x86)/Notepad++/notepad++.exe\"");

  • @jsulm said in Running EXE's:

    @Epiales666 said in Running EXE's:

    1. QString cmd = QString(""C:\Program Files (x86)\Notepad++\notepad++.exe"");

    This does not start any executable, it just creates a string variable containing a path to an executable.
    To avoid escaping of backslashes you can use / in Qt even on Windows:

    QString cmd = QString("\"C:/Program Files (x86)/Notepad++/notepad++.exe\"");

    Ah....Okay... ty for pointing that out. I've just used the first 3 examples myself. I thought I saw in a previous post where someone had used the 4th one to run an executable. My mistake. I will edit original post to remove that one. I do know, though, the first three work well. I'm sure each way have their own set parameters and reason for using them in the way they are, but if one is just opening an exe, then one way will work for it. Thanks again m8.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.