Solved

How to execute a batch file for application

Posted on 2001-07-31
3
920 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sameEnds challenge 3 133
VBA "SendKeys" Syntax for Multiple Keystrokes 7 103
fizzArray2 challenge 1 72
haveThree challenge 22 113
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 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

21 Experts available now in Live!

Get 1:1 Help Now