如何使用WinExec运行批处理文件? [英] How do I run a batch file with WinExec?

查看:470
本文介绍了如何使用WinExec运行批处理文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows 3.11,并回答有关运行具有某些属性的批处理文件的问题,有人建议使用WinExec.我怎么做?因为它是批处理文件而不是普通程序,所以有什么特别的事情吗?

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?

推荐答案

使用

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);

请注意,自Windows 95开始,WinExec已过时.相反,首选使用的功能包括 CreateProcess ShellExecute .

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

这篇关于如何使用WinExec运行批处理文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆