2

I'm using Windows 3.11, and in answer to a question about running batch files with certain attributes, someone suggested using WinExec. How do I do that? Is there something special to do because it's a batch file instead of a normal program?

Community
  • 1
  • 1
Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467

1 Answers1

2

Starting a batch file with WinExec is the same as starting anything else with WinExec. The first parameter is the command line to run, and the second parameter is the window-display parameter, indicating how you'd like the new program's window to appear. For example, in C:

WinExec("foo.bat", SW_SHOW);

Note that WinExec has been obsolete since Windows 95. Preferred functions to use instead include CreateProcess and ShellExecute.

Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467