更新时间:2023-02-08 08:24:33
To get the start menu location, use the SpecialFolder enumeration. Something like the following should get you started:
string startMenuDir = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
string shortcut = Path.Combine(startMenuDir, @"The Company\MyShortcut.lnk");
if (File.Exists(shortcut))
File.Delete(shortcut);
如果您不知道确切的文件名,则可以使用 Directory.GetDirectories .您还可以使用 Directory.Delete
If you don't know the exact file name, you could enumerate over all the files in the start menu folder using Directory.GetFiles or Directory.GetDirectories. You could also remove the entire folder ("The Company"), using Directory.Delete