First include a reference to C:\Windows\System32\wshom.ocx
Second, include the following using statement :-
using IWshRuntimeLibrary;
Third, Here is the code :-
// This creates a Folder Shortcut
IWshShell wsh = new WshShellClass();
IWshShortcut shortcut = (IWshShortcut) wsh.CreateShortcut (shortcutpathfilename);
shortcut.TargetPath = targetdir;
shortcut.Save();
shortcutpathfilename is a path & filename of the .lnk file.
targetdir is the directory the link points to.
1 comment:
This helped me out today, thanks.
Post a Comment