E
E
ertaquo2011-06-24 15:08:32
C++ / C#
ertaquo, 2011-06-24 15:08:32

How to create a shortcut in C# (or any other .net language)?

Rather, I know how to create a shortcut via wsh. But you can't drag Interop.IWshRuntimeLibrary.dll along with you - you need the application to fit in one file. Is it possible to embed this library somehow (it didn't work through ILMerge)? Or is there any way to create a shortcut without it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Laplace, 2011-06-24
@ertaquo

private static void configStep_addShortcutToStartupGroup()
{
using (ShellLink shortcut = new ShellLink())
{
    shortcut.Target = Application.ExecutablePath;
    shortcut.WorkingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
    shortcut.Description = "My Shorcut Name Here";
    shortcut.DisplayMode = ShellLink.LinkDisplayMode.edmNormal;
    shortcut.Save(STARTUP_SHORTCUT_FILEPATH);
}
}

stackoverflow.com/questions/234231/creating-application-shortcut-in-a-directory

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question