有没有办法从另一个进程 'GetCommandLineArgs' ?

Is there any way to 'GetCommandLineArgs' from another process?

我只是想用不同的参数启动和终止同一程序的多个实例。开始不是问题,但我怎样才能用特定的参数杀死一个进程?

static void Start(string args)
{
    var process = new Process
    {
        StartInfo = { FileName = "FileName", Arguments = args }
    };
    process.Start();
}

这是我使用 args 启动 procs 的方法。

我试图以某种方式保留它,但我没有成功。我已经在 Google 上搜索了最后一个小时,但没有得到任何有用的结果。

使用Dictionary<string, Process>存储进程和参数:

static Dictionary<string, Process> processes = new Dictionary<string, Process>();

static void StartProcess(string args)
{
    var process = new Process
    {
        StartInfo = { FileName = "FileName", Arguments = args }
    };
    process.Start();
    processes.Add(args, process);
}

static void StopProcess(string args)
{
    var process = processes[args];
    process.Kill();
    process.Dispose();
    processes.Remove(args);
}