Reputation: 356
I'm trying to replicate the start menu, I can get the paths to all the applications no problem. And have managed to get the path to target exe for shortcuts. I can launch most of them without any issues, but some of them (one currently, but I'd assume they'll be more) fail with the below error
Error => "The instruction at {hex} referenced memory at {hex}. The memory could not be read"
I've tried
Process.Start(pathToMyExe);
ProcessStartInfo processStartInfo = new ProcessStartInfo(pathToMyExe);
processStartInfo.UseShellExecute = false;
processStartInfo.WorkingDirectory = Path.GetDirectoryName(pathToMyExe);
Process.Start(processStartInfo);
ProcessStartInfo processStartInfo = new ProcessStartInfo(@"C:\Windows\System32\cmd.exe");
processStartInfo.Arguments = "/c \"" + pathToMyExe + "\"";
Process.Start(processStartInfo);
Some of these came back with the above error, some did nothing at all. The file I'm trying to launch is
Acrobat Reader DC
which is located at
C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe
on my machine. It launches fine from the start menu, and if I double click on it in explorer.
I've looked at all the other questions about similar problems, non of the solutions seem to work for this. Anyone got any ides of a way around this?
Upvotes: 0
Views: 1003
Reputation: 4546
The following works fine in both a console application and a WPF application.
var exePath = @"C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe";
new Process {StartInfo = {FileName = exePath}}.Start();
Upvotes: 1