如何在代码中运行一个小程序. [英] how can I run a small program in my code.

查看:114
本文介绍了如何在代码中运行一个小程序.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的代码中运行bat文件或exe文件.我正在使用Microsoft visual Studio2010.如果有人知道,请帮助我.
谢谢.

I want to run a bat file or a exe file in my code. I am using Microsoft visual Studio 2010. Please help me if someone knows that.
Thanks.

推荐答案

如果您使用的是托管代码,则
If you are using Managed code, then
Process p = new Process();
p.StartInfo.Arguments = "MyCommandLineParameters";
p.StartInfo.FileName = "MyCommand";
p.Start();


您可以使用 ^ ]函数.

You can use the ShellExecute[^] function.

ShellExecute(0,0,"myfile.bat",0,0,SW_SHOW)


这篇关于如何在代码中运行一个小程序.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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