Solved

How to execute a batch file for application

Posted on 2001-07-31
3
925 Views
Last Modified: 2013-11-20
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
0
Comment
Question by:pigangel
3 Comments
 
LVL 12

Expert Comment

by:migel
ID: 6337992
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...."
0
 
LVL 2

Accepted Solution

by:
tdubroff earned 80 total points
ID: 6338104
Use ShellExecute().

For Instance:
ShellExecute(hWnd, "open", "MyExe.exe", "my params are here", "", SW_SHOW);
0
 

Author Comment

by:pigangel
ID: 6339446
Thank you very much! It works.

-- pigangel
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Separate into files by filename 12 90
List out all word 7 332
Modbus - whats the maximum I can store in one register? 4 81
mapBully challenge 6 171
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

680 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