C#

shortcut 만들기

탑~! 2009. 10. 9. 15:02

using IWshRuntimeLibrary;
private WshShellClass WshShell;

private void btnShortcut_Click(object sender, System.EventArgs e)
{
// Create a new instance of WshShellClass
WshShell = new WshShellClass();

// Create the shortcut
IWshRuntimeLibrary.IWshShortcut MyShortcut;

// Choose the path for the shortcut
MyShortcut = (IWshRuntimeLibrary.IWshShortcut)WshShell.CreateShortcut(@"C:\MyShortcut.lnk");

// Where the shortcut should point to
MyShortcut.TargetPath = Application.ExecutablePath;

// Description for the shortcut
MyShortcut.Description = "Launch My Application";

// Location for the shortcut's icon
MyShortcut.IconLocation = Application.StartupPath + @"\app.ico";

// Create the shortcut at the given path
MyShortcut.Save();
}

[출처] http://www.geekpedia.com/tutorial125_Create-shortcuts-with-a-.NET-application.html

728x90
반응형