I’m launching the path C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools\IIS Manager.lnk via Process.Start, but it fails with The system cannot find the file specified.
The link shows up on a dir, so it exists.
Can it be permissions?
Notes:
- The path is auto-discovered by iterating over the
Start Menudirectory. - I can launch it via explorer and command line.
Clarifications:
-
Code is as follows:
public void Execute() { Process.Start(_shortcut.FullName);}
-
_shortcut is of type FileInfo
- _shortcut.Exists is true, so the file can be found
- replacing _shortcut.FullName with the explicit path @”C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools\IIS Manager.lnk” has the same effect.
- This is a WPF app using Caliburn and MEF.
- Running as Administrator has the same effect.
This here on the other hand seems to work:
[Fact]
public void TestIisManager()
{
var path = new FileInfo(@"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools\IIS Manager.lnk");
Process.Start(path.FullName);
}
It does seem to be a bit “environment” based.
Second clarification:
- It seems to work in a Windows 7 x86 but not in a Windows 7 x64.
Found the issue.
The WPF application was compiled as x86 (all other dlls were compiled as AnyCPU), and when launching some executables or links in a 64 bit machine it failed.
Changing the “Platform Target” to AnyCPU fixes this.