引用COM组件Windows Script Host Object Model; //设置一个快捷方式
IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShellClass();
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut("c:\\a.lnk");
shortcut.TargetPath = "notepad.exe";
shortcut.Arguments = "c:\\a.txt";
shortcut.Description = "My Shortcut";
shortcut.Hotkey = "CTRL+SHIFT+N";
shortcut.IconLocation = "notepad.exe, 0";
shortcut.Save(); //得到快捷方式属性
shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut("c:\\x.lnk");
MessageBox.Show(ws.Description);
IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShellClass();
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut("c:\\a.lnk");
shortcut.TargetPath = "notepad.exe";
shortcut.Arguments = "c:\\a.txt";
shortcut.Description = "My Shortcut";
shortcut.Hotkey = "CTRL+SHIFT+N";
shortcut.IconLocation = "notepad.exe, 0";
shortcut.Save(); //得到快捷方式属性
shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut("c:\\x.lnk");
MessageBox.Show(ws.Description);
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货