Solved

How to execute a batch file for application

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

758 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

19 Experts available now in Live!

Get 1:1 Help Now