C:\Program Files\Notepad++\notepad++.exe
C: \ Program Files \ Notepad ++ \ notepad ++. Exe
C: \ Program Files (x86) \ AIMP \ AIMP.exe
Process proc = new Process(); proc.StartInfo.FileName = @"c:\myShortcut.lnk"; proc.UseShellExecute = false; proc.Start();
Quote:Apparently Process cannot distinguish the location of the file if you run the program through a shortcut (.lnk) Because with the path to the file "C: \ Program Files" in the shortcut (.lnk) in the x64 system Process will return the value "C: \ Program Files (x86)" and give the error "The specified path does not exist." what does not appear in the message for the shortcut processInfo.ErrorDialog = true; img-2020-05-28-08-30-40.png — Yandex.Disk[^]
string program_files_folder = Environment.Is64BitProcess ? Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) : Environment.GetEnvironmentVariable("ProgramW6432"); string programFilesX86 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)