Visual C++, How to create a Windows App you can launch from DOS and Windows

Posted on 2010-01-07
Last Modified: 2013-12-14
I am writing an interactive Windows program to load a text file to a database.  I am writing the app to run in both interactive and 'automatic' modes, so that I can schedule a regular file upload.
I would like to be able to trigger the app in automatic mode from a DOS shell, so that I can include it in batch files.  This would be similar to launching Notepad.exe from the DOS prompt.
The current build of the app will not trigger from DOS, I get "The system cannot execute the specified program".
What do I need to do to make the Windows app launchable from a DOS shell?
Question by:stevehibbert
    LVL 26

    Assisted Solution

    Do you mean DOS? Or commandline from the same OS you launch your app by double clicking it.
    If it is the same OS then your app should working normally.
    This must work... :)
    Did you change the path to app folder (cd some_path command)?
    Did you try to launch your app using start command? "start yourapp" in commandline.
    LVL 19

    Assisted Solution

    On the same machine or on a different machine?

    On a different machine may be you need to install the visual c runtime libraries
    LVL 7

    Accepted Solution

    "the system cannot execute the specified program" means that the execution of your prog crashes. any .exe could be started from a NT command window (DOS-Box). If you have a console program (project type Win32-console application) it would use the same command window for output and not open a new window.

    Author Comment

    This was an error in my code, I've just found out, and "js-profi" is correct.
    "alb66" is also right about installing the C-runtimes, but I statically linked, so the runtime stuff is contained in the exe.  "gtworek" gives good hints about checking what you're doing to remove numpty errors, and it turns out that this was a error of that kind.

    Thanks very much for the replies, but I think js-profi gets the points here.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
    Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now