using IWshRuntimeLibrary;
//建立对象
WshShell shell = new WshShell();
//生成快捷方式文件,指定路径及文件名
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(@"C:\Documents and Settings\Administrator\桌面\" + "my.lnk");
//快捷方式指向的目标
shortcut.TargetPath = @"H:\winform\DeskHelper\DeskHelper\DeskHelper\bin\Debug\DeskHelper.exe";
//起始目录
shortcut.WorkingDirectory = @"H:\winform\DeskHelper\DeskHelper\DeskHelper\bin\Debug\DeskHelper.exe";
//窗口类型
shortcut.WindowStyle = 1;
//描述
shortcut.Description = "my Application";
//图标
shortcut.IconLocation = System.Environment.SystemDirectory + "\\" + "shell32.dll, 163";
//保存,注意一定要保存,否则无效
shortcut.Save();
阅读(1429) | 评论(0) | 转发(0) |