how to create desktop shortcut icon

chidambaram

Well-known member
Joined
Dec 27, 2007
Messages
62
Location
Chennai,India
Programming Experience
Beginner
Hi,

I am working in VB.NET 2003.

I have one exe file in a particular folder.

I want to create desktop shortcut icon for that exe file.

How can i do this?

Thanks in advance...
 
Hey, You can use the folowing code to create a shorcut to a file...

VB.NET:
Imports IWshRuntimeLibrary

...

Dim shell As WshShell = New WshShellClass
' Determines the Desktop folder for current user
Dim Desktop As String = Environment.GetFolderPath(SpecialFolder.DesktopDirectory)
Dim shortcut As WshShortcut = shell.CreateShortcut(Desktop & "/ShorcutName.lnk")
shortcut.TargetPath = "The exe to create shortcut for"
shortcut.Description = "Description (optional)"
shortcut.Save()

Hope that helps
-Tiger
 
Back
Top