Ejemplo n.º 1
0
        static public void CreateShortcut(string shortcutPath, string targetPath)
        {
            WshShell     shell          = null;
            IWshShell    shellInterface = null;
            IWshShortcut shortcut       = null;

            try
            {
                shell                 = new WshShell();
                shellInterface        = (IWshShell)shell;
                shortcut              = shellInterface.CreateShortcut(shortcutPath);
                shortcut.Description  = targetPath;
                shortcut.TargetPath   = targetPath;
                shortcut.IconLocation = targetPath + ",0";
                shortcut.Save();
            }

            finally
            {
                Release(shortcut);
                Release(shellInterface);
                Release(shell);
            }
        }