Skip to content
Tags

,

Launch IE with ProcessStartInfo

by on August 27, 2012

This is probably the cleanest and nicest way to launch a program that i’ve found so far.

using System.Diagnostics;

void OpenIEWithStartInfo()
{
ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
Process.Start(startInfo);
startInfo.Arguments = "website goes here";
Process.Start(startInfo);
}

It’s clean, clear and easy to follow and understand. If you want to leave the Arguments out, you can. However, if you’re doing that, you may aswell use something even simpler:

void LaunchIE()
{
Process.Start("IExplore.exe");
}

The problem with the single line start up is you can’t specify things like the window starting maximised, etc. Which is why i prefer the first function better.

From → C#, Code Snippets

Leave a Comment

Leave a comment

NE1 Atoll

The Official blog of NE1 Games

Selenium for .Net using C# language

Adventures in Coding, gaming and other fun things in my life

Coded UI 101 - Understanding Coded UI Tests

Adventures in Coding, gaming and other fun things in my life