forum

Home / DeveloperSection / Forums / How to create an internet shortcut with an icon in c#?

How to create an internet shortcut with an icon in c#?

Anonymous User 6775 31-Jan-2014

I want to create an internet shortcut (url file) with a custom icon 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 does not set a custom icon. How would I set the icon?


c# c# 
Updated on 31-Jan-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By