string dk =System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);//得到桌面文件夹
IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShellClass();
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(@dk+" //a.lnk");
shortcut.TargetPath = @"C:/Program Files/Internet Explorer/IEXPLORE.EXE";
shortcut.Arguments = " http://localhost/2005/bay";
shortcut.Description = "My Shortcut";
shortcut.Hotkey = "CTRL+SHIFT+N";
shortcut.IconLocation = "notepad.exe, 0";
shortcut.Save();
IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShellClass();
IWshRuntimeLibrary.IWshShortcut shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(@dk+" //a.lnk");
shortcut.TargetPath = @"C:/Program Files/Internet Explorer/IEXPLORE.EXE";
shortcut.Arguments = " http://localhost/2005/bay";
shortcut.Description = "My Shortcut";
shortcut.Hotkey = "CTRL+SHIFT+N";
shortcut.IconLocation = "notepad.exe, 0";
shortcut.Save();
博客给出了在Windows系统下创建快捷方式的代码。通过获取桌面文件夹路径,利用WshShell类创建快捷方式对象,设置目标路径、参数、描述等属性,最后保存快捷方式,实现了在桌面创建指向特定网页的IE浏览器快捷方式。
1778

被折叠的 条评论
为什么被折叠?



