RunApplication lnk file

Ranorex Studio, Spy, Recorder, and Driver.
Posts: 25
Joined: Tue May 05, 2015 11:25 am

RunApplication lnk file

Post by eric.franc » Wed Nov 09, 2016 1:45 pm


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

User avatar
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: RunApplication lnk file

Post by odklizec » Wed Nov 09, 2016 2:33 pm

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration