在 C# 中启动特定的 chrome 配置文件

Launching a specific chrome profile in C#

我有 3 个 chrome 配置文件,我正在使用 C# WinForms 2022 在 WinForm 的单个面板中加载每个配置文件。 例如,我知道如何在单个面板中启动私人配置文件,就像这样

var url = "https://google.com";
var process = new Process();
process.StartInfo = new ProcessStartInfo("chrome.exe");
process.StartInfo.Arguments = url + " --incognito";

以上代码运行良好。但现在我正在尝试将两个面板添加到相同的表单,并将 chrome 配置文件 2 和 3 分别加载到面板 2 和 3 中。
我正在为配置文件 3 使用以下代码,但它对我没有任何好处

var url = "https://google.com";
var process = new Process();
process.StartInfo = new ProcessStartInfo("chrome.exe");
process.StartInfo.Arguments = url + @"--profile-directory =""Profile 3""";

process.StartInfo.Arguments = url + "--profile-directory=\"Profile3\"";

我无法在除私人配置文件和默认配置文件之外的任何面板中加载特定配置文件。

谁能告诉我这段代码有什么问题吗?

下面的代码有效我想你错过了靠近 --profile 的 space。

var url = "https://google.com";
            var process = new Process();
            process.StartInfo = new ProcessStartInfo("chrome.exe");
            //process.StartInfo.Arguments = url + " --incognito";
            process.StartInfo.Arguments = url + @" --profile-directory=""Profile 2""";