简体   繁体   English

在运行 exe 时传递命令行参数的内容。 有多个实例以相同的 exe 名称运行

[英]What to pass command line argument in running exe. having multiple instance running with same exe name

I am making a window service which will trigger at specific time to start/run an .exe.我正在制作一个窗口服务,它将在特定时间触发以启动/运行 .exe。 There are many instance running depend on trigger event Example **有很多实例运行依赖于触发事件示例**

1. Trigger A fire at morning and start/run controller.EXE
2. Trigger B fire at Afternoon and start/run controller.EXE

** EDIT **编辑

I have used below我在下面使用过

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

Now A and B both are running.现在 A 和 B 都在运行。 I want to pass command line argument to process A while it is running我想在进程 A 运行时将命令行参数传递给它

How can I achieve that.我怎样才能做到这一点。 Is that possible with multiple exe having same name(controller.EXE)?使用多个具有相同名称的 exe(controller.EXE)可以吗? 在此处输入图片说明

Answer to this question:回答这个问题:

Is that possible with multiple exe having same name(controller.EXE)是否可以使用多个具有相同名称的 exe(controller.EXE)

Yes, sure.是的,当然。 Look at Windows Task Manager in Process tab and you will see a lot of processes running with the same name.在进程选项卡中查看 Windows 任务管理器,您会看到许多以相同名称运行的进程。 For instance, every tab in Chrome browser is running in its own process例如,Chrome 浏览器中的每个标签页都在自己的进程中运行

在此处输入图片说明 . .

About this对这个

What to pass command line argument in running exe在运行 exe 时传递命令行参数的内容

You can pass any parameters you need or nothing.您可以传递任何需要的参数,也可以不传递任何参数。 It depends on your application logic.这取决于您的应用程序逻辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM