加载com组件:【引用】右键-->添加引用-->com组件--->选择“Windows Script Host Object Model”
引用命名空间:using IWshRuntimeLibrary;
代码如下:
private void CreateShortcutFile(string Title, string URL, string SpecialFolder) { // Create shortcut file, based on Title System.IO.StreamWriter objWriter = System.IO.File.CreateText(SpecialFolder + "//" + Title + ".url"); // Write URL to file objWriter.WriteLine("[InternetShortcut]"); objWriter.WriteLine("URL=" + URL); // Close file objWriter.Close(); }
已有 3766 位网友参与,快来吐槽:
发表评论