Reputation: 113
I'm trying to access the target path from a shortcut(.lnk) file on a 64bit machine using my 32 bit application. To get the path, I was using the following code.
WshShell shell = new WshShell();
IWshShortcut link = (IWshShortcut)shell.CreateShortcut(flexShortcut);
FLEXEXE = link.TargetPath;
This returns the path C:\Program Files (X86)\..
instead of C:\Program Files\..
Is there any work around for this?
Upvotes: 5
Views: 1849
Reputation: 1
For anyone still having this issue, I found that leaving the Platform Target set to "Any CPU" and unticking the option "Prefer 32-bit" fixed it for me. This way your application will maintain the flexibility of being compatible with both architectures, and still return the shortcut link TargetPath (either x86 / x64) correctly.
Upvotes: 0
Reputation: 10588
This is a general problem in Windows. Try editing a file in a System32 folder (e.g. applicationHost.config) with a 32-bit editor. You will be editing the file from the SysWOW64 folder instead... It's more than strange...
Upvotes: 0
Reputation: 113
A trick to be used is to
Upvotes: 2