Cannot Find Win10 Programmatically C # Boot Folder

On Windows 10, this simple code throws a directory exception not found. I can manually go to the directory manually. What gives?

shortcut_location_root = Environment.GetFolderPath(Environment.SpecialFolder.Startup);

if (String.IsNullOrEmpty(shortcut_location_root))
{   
  //FALLS IN HERE
    shortcut_location_root =
      Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Microsoft\Windows\Start Menu\Programs\Startup";

//BLOWS UP HERE DIRECTORY NOT FOUND
 if (File.Exists(Path.Combine(shortcut_location_root, "someFile" + ".url")))
 {
     //do stuff
 }
+4
source share

Source: https://habr.com/ru/post/1673138/


All Articles