在运行Windows 10时,运行这段简单的代码会抛出目录未找到的异常。我可以手动导航到该目录并正常访问。是什么原因呢?
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
}