---
title: "How to create an internet shortcut with an icon in c#?"  
description: "How to create an internet shortcut with an icon in c#?"  
author: "Anonymous User"  
published: 2014-01-31  
updated: 2014-01-31  
canonical: https://www.mindstick.com/forum/1936/how-to-create-an-internet-shortcut-with-an-icon-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How to create an internet shortcut with an icon in c#?

I want to create an [internet](https://www.mindstick.com/articles/44650/what-should-you-do-during-an-internet-outage) shortcut ([url](https://www.mindstick.com/forum/436/url-redirection) [file](https://www.mindstick.com/articles/59/encrypting-and-decrypting-files-using-c-sharp)) with a [custom](https://www.mindstick.com/blog/12298/use-custom-writing-services-to-get-through-the-finals) [icon](https://www.mindstick.com/articles/13090/icon-the-identity-of-your-brand) on the desktop. To create the shortcut, I currently use:

```
    private void CreateShortcut(string name, string url)    {        string deskDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);        using (StreamWriter writer = new StreamWriter(deskDir + "\\" + name + ".url"))        {            writer.WriteLine("[InternetShortcut]");            writer.WriteLine("URL=" + url);            writer.Flush();        }    }
```

But this [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) does not set a custom icon. How would I set the icon?

## Replies

### Reply by Pravesh Singh

Hi Jeet,\

Set IconIndex and IconFile parameters:

```
[InternetShortcut]URL=<url>IconIndex=0IconFile=<path to custom icon icon file>
```


---

Original Source: https://www.mindstick.com/forum/1936/how-to-create-an-internet-shortcut-with-an-icon-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
