Launch Chrome and Other Applications in C#

Hi Everyone,

Short post, I just wanted to put down into writing how I open Chrome windows and other applications in C# code. This is used by one of my startup programs which allowed me to open all my most used applications with ease 🙂

First I create a Process variables using the System.Diagnostics resource:

Process process = new Process();

I then point the process variables start info filename to the location of my Chrome executable:

process.StartInfo.FileName = @"C:\Path\To\Chrome.exe";

I then add my URL to the start info arguments:

process.StartInfo.Arguments = @"https://bbc.co.uk";

Then, if I want the link to open as a new window instead of onto an existing Chrome window I use:

process.StartInfo.Arguments += " --new-windows";

Finally, I start the process:

process.Start();

Here are some different scenarios:

Opening a URL in an existing Chrome window:

Process process = new Process();
process.StartInfo.FileName = @"C:\Path\To\Chrome.exe";
process.StartInfo.Arguments = @"https://bbc.co.uk" ;
process.Start()

Opening a URL in a new Chrome window:

Process process = new Process();
process.StartInfo.FileName = @"C:\Path\To\chrome.exe";
process.StartInfo.Arguments = @"https://bbc.co.uk";
process.StartInfo.Arguments += " --new-window";
process.Start();

Opening multiple URLs in a new Chrome window:

List<String> URLs = new List<String>(){
    "https://bbc.co.uk",
    "https://mharwood.uk",
    "https://youtube.com"
}

Process process = new Process();
process.StartInfo.FileName = @"C:\Path\To\chrome.exe";
foreach (string i in URLs)
{
    process.StartInfo.Arguments += i;
}
process.StartInfo.Arguments += " --new-window";
process.Start();

Opening different programs:

List<String> Programs = new List<String>(){
    @"C:\Path\To\First\Program.exe",
    @"C:\Path\To\Second\Program.exe",
    @"C:\Path\To\Third\Program.exe"
}

foreach(string i in Programs){
    Process.Start(i);
}

I hope this is useful information for someone. Enjoy!

SharePoint URL Changing

There are two main ways that I change the URL of a list or library on a SharePoint site. First off I’d like to explain why I often have to do these tricks. Whenever you create a new SharePoint site from a template, even after you change the names of all the lists and libraries in a web page, the URL will still reference what ever the template lists were called.

Option 1 – SharePoint Designer

To change the URL in SharePoint designer, open your site using the URL “http://HOSTNAME/sites/SITENAME” and this should give you list of items in the left hand column resembling the screenshot below:

SharePoint Designer Column

You should see that the bottom option says “All Files“, double click this and go into “Lists“. This will show all of the lists on your site and you should see that they are all using the old name which is the cause of the incorrect URLs. Simply rename these lists to what ever you need and the URL will change.

 

Option 2 – File Explorer

If you don’t see the “All Files” section in SharePoint designer then this method can be used instead. Open a file explorer and navigate to your site. You can see how I have done this below:

File Explorer

Now go into “Lists” and you should be able to see the incorrectly named lists. Simply rename these lists and the URL will change.

 

I’m not sure why the “All Files” section in SharePoint designer doesn’t show so If anyone can shed some light on that I would be appreciated. Enjoy!