C# 在运行时或更早的时候设置进程描述 [英] C# Set process description on run time or earlier
问题描述
我有一个 WPF 应用程序,它启动多个托管"进程,当我启动我的 WPF 应用程序时,它会多次使用不同的参数启动相同的 .exe 进程.
I have a WPF Application that starts several "hosted" processes, When i start my WPF Application, It will start the same .exe process couple of times with different arguments in each time.
我想用不同的名称(或描述)命名每个进程 - 这样我就可以在任务管理器中检测哪个进程(如果我想关闭其中一个).
I want to name each process with a different name (or description) - so I could detect which is which in Task manager (if i want to shutdown one of them).
我知道我无法为每个进程设置不同的进程 ImageName - 因为它们都是相同的实际 .exe 文件.
I understand i cannot set a different process ImageName for each - since they are all the same actual .exe file.
有没有办法至少在运行时或开始时更改流程描述(更改 ProcessStartInfo 参数或类似的东西)..?
Is there a way I atleast change the process description during run-time, or during its start time (change a ProcessStartInfo parameter or something like that) ..?
推荐答案
不,你不能;描述"列显示进程启动时由 Windows 加载的值.它来自版本信息部分嵌入在可执行文件中.
No you can't; the "description" column displays a value that is loaded by Windows when your process starts. It comes from a version information section embedded in the executable file.
您可以做的只是显示任务管理器的命令行"列.
What you could do is simply display the "command line" column of task manager.
这篇关于C# 在运行时或更早的时候设置进程描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!