现在有程序a.exe 和程序b.exe ,运行a.exe的某个过程中会运行b.exe ,但是b.exe只能由a.exe传递正确的参数才能运行!怎么实现啊?单独点击b.exe是无法运行的!winform!
解决方案 »
- 用c#怎么把数据库中用户列表显示在treeview,并且在数据库中添加用户之后能在treeview更新
- ini文件为空,但能读出信息
- path.combin 为什么说找不到咱径
- sql语句查询出来的一个值赋 给一个控件的text属性 问题
- 求存储过程,万分感谢帮忙的朋友,所有分送上. 只有33分! 但是帮帮忙吧! 谢谢了!
- sql server,如何查询前100万条记录的最后一条?
- DATAGRID到底怎么删除选中的那一行
- smtp服务认证问题???
- C#远程调用的问题,请高手指教
- 一个菜单的问题
- Input string was not in a correct format 的问题?
- 个人关于委托的看法,但不是下结论。请各位交流。
b.exe 的Program里:
static void Main(string[] parameter)
{ Application.Run(new Form1(parameter[0].ToString()));
}Form1.cs的构造函数里:
public Form_Play(string par)
{
//传值可以用了
}
比如:
if(true)
{
system.Diagnostics.process.start("b.exe")b 程序所在的位置
}
namespace 程序A
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("我是程序A,我会打开程序B");
System.Diagnostics.Process.Start("程序B.exe", "/我是程序A /请运行");
Console.ReadLine();
}
}
}namespace 程序B
{
class Program
{
static void Main(string[] args)
{
if (args != null && args.Length == 2)
{
if (args[0] == "/我是程序A" && args[1] == "/请运行")
{
Console.WriteLine("我已出仓,感觉良好");
Console.ReadLine();
}
}
}
}
}
startInfo.FileName = "1.exe"; //参数用空格分开
startInfo.Arguments = "arg1"+" "+"arg2"+" "+"arg3";
System.Diagnostics.Process.Start(startInfo);