Daniel Hamutel
Daniel Hamutel

Reputation: 653

How can i find a shortcut for a program and running the exe file in the shortcut?

On my pc the shortcut is in this location

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\OpenGrADS 2.0

But i'm not sure if this is for every windows i'm using windows 8.1 pro but not sure if when someone will install this program on windows 7 or any other os it will put it in the same location.

Second in this directory i have a shortcut file: GrADS Prompt and inside the file the shortcut in the properties i see: C:\OpenGrADS\Contents\Cygwin\Versions\2.0.2.oga.2\i686\opengrads.exe

In my program i did:

string exepath = @"C:\OpenGrADS\Contents\Cygwin\Versions\2.0.2.oga.2\i686\opengrads.exe";

But i'm not sure if anyone else installed the program to this location that's why i want to find the shortcut and then to run the exe inside the short cut file properties.

Or maybe in the constructor or adding a button to the designer to check if the file not exist then open a filebroswer:

if (!File.Exists(exepath))
            {

            }

Using this logic is better so the user will browse alone to the file location ?

Upvotes: 0

Views: 614

Answers (1)

CoreMeltdown
CoreMeltdown

Reputation: 194

In my application where I require 3rd party programs to be installed I create options form in which I allow users to set the required paths and then I store all of required data in Application Settings

Upvotes: 1

Related Questions