tags:

views:

69

answers:

2

How to if I want to write an application that launches Firefox with 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.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
    }
  }
}
+6  A: 

You will need to specify the process.StartInfo.Arguments

See this question: http://stackoverflow.com/questions/1765907/calling-an-application-from-asp-net-mvc/1765941#1765941

Jan Jongboom
Thanks good link.
Chris_45
A: 

You will need to use the process.StartInfo.Arguments, as shown here:

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

    }
  }
}
Joe Barone
Ok great thanks!
Chris_45