首页 新闻 赞助 找找看

c#如何修改快捷方式(lnk)的目标属性,而不影响其使用,最好能有代码说明

0
悬赏园豆:80 [已关闭问题] 关闭于 2014-02-28 21:08
            //获取桌面路径
            string lnkPath = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\" + "360安全浏览器比价版" + ".lnk";
            //获取启动文件路径
            string lnkPath1 = System.Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\" + Application.ProductName + ".lnk";
            IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShell();
            IWshRuntimeLibrary.IWshShortcut shortCut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(lnkPath);
            shortCut.TargetPath = shortCut.TargetPath + "www.baidu.com";
            shortCut.WindowStyle = shortCut.WindowStyle;
            shortCut.Description = shortCut.Description;
            shortCut.IconLocation = shortCut.IconLocation;
            shortCut.WorkingDirectory = shortCut.WorkingDirectory;
            shortCut.Save();

上面的代码修改完之后,快捷方式就不能用了。

Carl --卡尔的主页 Carl --卡尔 | 初学一级 | 园豆:69
提问于:2014-02-28 20:38
< >
分享
所有回答(1)
0

  shortCut.TargetPath = shortCut.TargetPath ;

Carl --卡尔 | 园豆:69 (初学一级) | 2014-02-28 21:07
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册