none
Problem in executing command prompt commands through application RRS feed

  • Question

  • Hi,

    I am facing issue in executing commands through VC++ application.

    My application is a dialog based MFC application in VS2008.

    I want to execute below commands programmatically.

    devenv D:\TestApp\TestApp.sln /rebuild release

    devenv D:\TestApp\TestApp.sln /rebuild debug

    But I am not able to set the current directory path as "D:\TestApp\" programatically.

    Through which API I can execute multiple commands on command prompt programmatically same as  we do manually on cmd.

    Please Help.

    Thanks in Advance. 


    Thanks & Regards, Mayank Agarwal

    Tuesday, March 24, 2015 7:21 AM

Answers

  • I want to execute below commands programmatically.

    devenv D:\TestApp\TestApp.sln /rebuild release

    devenv D:\TestApp\TestApp.sln /rebuild debug

    But I am not able to set the current directory path as "D:\TestApp\" programatically.

    Through which API I can execute multiple commands on command prompt programmatically same as  we do manually on cmd.

    Why can you "not able to set the current directory path as "D:\TestApp\" programatically"? Are you forgetting to escape the backslashes?

    Why to you need to set the current directory anyway?

    What is the problem with executing multiple commands?

    As to your basic goal, have you looked at

    system()
    ShellExecute()
    ShelExecuteEx()
    CreateProcess()

    ? Perhaps you should show us what you have tried.


    David Wilkinson | Visual C++ MVP

    • Marked as answer by Shu 2017 Wednesday, April 1, 2015 12:43 PM
    Tuesday, March 24, 2015 10:17 AM