command prompt from C++ program

Feb 15, 2013 at 7:18am
Hi,
I am facing a problem in C++,I want to execute a command in Command prompt from a specific path.I am able o select a path and execute cmd.exe using the function ShellExecute but the problem is after selecting the path I am not able to execute the command, the command is appearing on another command prompt.Is there any solution to solve this Problem



Thanks in advance
Feb 15, 2013 at 7:37am
Int get it? do you wanna execute a command from CMD?

try this first

system("YOUR COMMAND!")

OR you want to use ShellExecute?
Last edited on Feb 15, 2013 at 7:38am
Feb 15, 2013 at 7:41am
I am able to open the command prompt from C++ using ShellExecute..
Now I want to execute an exe command on that opened command prompt..
Last edited on Feb 15, 2013 at 7:43am
Feb 15, 2013 at 8:08am
sorry for late
here is your code

ShellExecute(0,"open","cmd","/C c:\\1.exe",0,SW_SHOW);

"/C c:\\Your APP.exe" <<<
Last edited on Feb 15, 2013 at 8:09am
Feb 15, 2013 at 8:19am
thanks for the reply.
actually i want to execute a query " bpl -p ..............." which is defined in a specific path. say c:\\program files
now i have to execute these steps..
1. execute cmd.exe
2. change the path to C:\\program files
3. execute the command "bpl -p ...."

first two steps r working for me..
i want to do the last step..

Topic archived. No new replies allowed.