Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在运行exe时传递命令行参数的内容。使用相同的exe名称运行多个实例_C#_.net_Quartz.net - Fatal编程技术网

C# 在运行exe时传递命令行参数的内容。使用相同的exe名称运行多个实例

C# 在运行exe时传递命令行参数的内容。使用相同的exe名称运行多个实例,c#,.net,quartz.net,C#,.net,Quartz.net,我正在创建一个窗口服务,它将在特定时间触发以启动/运行.exe。有许多实例依赖于触发器事件运行 例子 ** ** 编辑 我在下面用过 Process A = new Process(); A.StartInfo.FileName = @"Controller.exe"; A.StartInfo.Arguments = strXML+" "+strEndDate; A.

我正在创建一个窗口服务,它将在特定时间触发以启动/运行.exe。有许多实例依赖于触发器事件运行 例子 **

** 编辑

我在下面用过

                Process A = new Process();
                A.StartInfo.FileName = @"Controller.exe"; 
                A.StartInfo.Arguments = strXML+" "+strEndDate;
                A.Start();

                Process B = new Process();
                B.StartInfo.FileName = @"Controller.exe"; 
                B.StartInfo.Arguments = strXML+" "+strEndDate;
                B.Start();
现在A和B都在运行。我想在进程运行时将命令行参数传递给进程


我怎样才能做到这一点。如果多个exe具有相同的名称(controller.exe),是否可能出现这种情况?

回答此问题:

如果多个exe具有相同的名称(controller.exe),这是否可能

当然可以。查看“进程”选项卡中的Windows任务管理器,您将看到许多进程以相同的名称运行。例如,Chrome浏览器中的每个选项卡都在自己的进程中运行

关于这个

在运行exe时传递命令行参数的内容


您可以传递任何需要的参数,也可以不传递任何参数。这取决于您的应用程序逻辑。

您是否已经设置了与controller.exe的单个实例的通信方法?如果您想使用参数启动“controller.exe”,可以使用带参数的ProcessStartInfo]()。@Graffito否,controller.exe是窗口应用程序。我可以使用互斥吗?如果是的话,我该怎么做?我必须在命令行参数中传递什么?Windows提供了许多进程间通信的方法。提到一个可能的解决办法是。由于您可能有多个“Controller.exe”实例,您应该为每个“Controller.exe”实例指定命令行中提供的不同邮箱名称。最后,您的进程可以通过在适当的邮箱上书写来与A或B通信。
                Process A = new Process();
                A.StartInfo.FileName = @"Controller.exe"; 
                A.StartInfo.Arguments = strXML+" "+strEndDate;
                A.Start();

                Process B = new Process();
                B.StartInfo.FileName = @"Controller.exe"; 
                B.StartInfo.Arguments = strXML+" "+strEndDate;
                B.Start();