如果我想编写一个使用参数启动Firefox的应用程序?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace Launcher
{
public static class Program
{
public static void Main(string[] args)
{
Process.Start("C:/Program Files/Mozilla Firefox/firefox.exe");//this is ok
Process.Start("C:/Program Files/Mozilla Firefox/firefox.exe -P MyProfile -no-remote");// this doesn't work
}
}
}
答案 0 :(得分:6)
您需要指定process.StartInfo.Arguments
答案 1 :(得分:0)
您需要使用process.StartInfo.Arguments,如下所示:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace Launcher
{
public static class Program
{
public static void Main(string[] args)
{
Process firefox = new Process();
firefox.StartInfo.FileName = @"C:\Program Files\Mozilla Firefox\firefox.exe";
firefox.StartInfo.Arguments = "-P MyProfile -no-remote";
firefox.Start();
}
}
}