Page 1 of 1

RunApplication lnk file

Posted: Wed Nov 09, 2016 1:45 pm
by eric.franc
Hello,

I have some issue with RunApplication, I am not able to start an lnk file.
I have a case that I need to start the application from a shortcut.

Code: Select all

string path = "C:\\Program Files\\MyApp\\MyApp.exe";
if( !File.Exists(path ) )
    path += ".lnk";
Report.Log(ReportLevel.Info, "Application", "Run application 'C:\\Program Files\\MyApp\\MyApp.exe' with arguments '' in normal mode.");
 Host.Local.RunApplication(path, "", Path.GetDirectoryName(path), false);
I get the following error:

Failed to run application 'C:\Program Files\MyApp\MyApp.exe.lnk'.
The system cannot find the path specified

Re: RunApplication lnk file

Posted: Wed Nov 09, 2016 2:33 pm
by odklizec
Probably stupid question, but are you sure the path C:\Program Files\MyApp\MyApp.exe.lnk is OK/exists? By default, shortcut name looks like this: MyApp.exe - Shortcut.lnk. So make sure the lnk file name and/or path is valid.