Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I create a shortcut programmatically?

1 view
Skip to first unread message

Dave Morgereth

unread,
Apr 19, 2002, 1:16:02 PM4/19/02
to
I'd like to programmatically create a shortcut on the desktop. Is there a
way to do it in C#?

TIA
Dave


Mattias Sjögren

unread,
Apr 19, 2002, 1:34:13 PM4/19/02
to
Dave,

>I'd like to programmatically create a shortcut on the desktop. Is there a
>way to do it in C#?

http://www.msjogren.net/dotnet/eng/samples/dotnet_shelllink.asp


Mattias

===
Mattias Sjögren (VB MVP)
mattias @ mvps.org
http://www.msjogren.net/dotnet/

Jim Hollenhorst

unread,
Apr 20, 2002, 11:10:55 AM4/20/02
to
Here is a much simpler way. Just use the Windows Scripting Host. Be sure to
include a reference to the IWshRuntimeLibrary, then create a WshShell object
and an IWshShortcut. You may want to use the object browser to discover the
other properties and methods.

using IWshRuntimeLibrary;
...

WshShell shell = new WshShell();
IWshShortcut link =
(IWshShortcut)shell.CreateShortcut(LinkFileFullName);
link.TargetPath=OriginalFileFullName;
link.Description="The Description";
link.Save();

Jim

0 new messages