Link to home
Start Free TrialLog in
Avatar of pigangel
pigangel

asked on

How to execute a batch file for application

Hello, Experts*
  my application is MFC-dialog base program. my program need to have a function like this : when users click a button, a batch file will be executed, and to batch program needs some argument, I don't know how to implement this because I tried "system" and "winexec", and they didn't work.
  can somebody kindly give me some hints, and example will be very appreciated.
  Thanks you very much!

--pigangel
Avatar of migel
migel

Hi!
you can use CreateProcess and pass to it string like this:
"cmd /c mybat.bat param1 param2 param3"
<< for windows NT for 95+ you must write:
"command.com /c mybat.bat...."
ASKER CERTIFIED SOLUTION
Avatar of tdubroff
tdubroff

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pigangel

ASKER

Thank you very much! It works.

-- pigangel