Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to find path of an exe

How to find path of an exe

Scheduled Pinned Locked Moved C#
questionhelptutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SatyaDY
    wrote on last edited by
    #1

    Hi guys, How can we find a path of an exe using it's name?? The exe is some third party exe and can be anywhere in the system. How can I find the path?? MY requirement is to start this exe from my Service. Can any body help me with some code snippet? It's very urgent. Regards, Satya.

    M M 2 Replies Last reply
    0
    • S SatyaDY

      Hi guys, How can we find a path of an exe using it's name?? The exe is some third party exe and can be anywhere in the system. How can I find the path?? MY requirement is to start this exe from my Service. Can any body help me with some code snippet? It's very urgent. Regards, Satya.

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      There is no general way to do this. Usually an application that can be installed anywhere will create a registry entry holding the installation path. Take a look at HKLM\Software, you might be lucky and find an entry for your third party exe. Other than this you'd have to scan the hard discs of the target computer, which usually isn't feasible. Or you ask the user during installation by presenting a file open box with the exe filename as filter and then store the path in your configuration. Regards, mav

      S 1 Reply Last reply
      0
      • M mav northwind

        There is no general way to do this. Usually an application that can be installed anywhere will create a registry entry holding the installation path. Take a look at HKLM\Software, you might be lucky and find an entry for your third party exe. Other than this you'd have to scan the hard discs of the target computer, which usually isn't feasible. Or you ask the user during installation by presenting a file open box with the exe filename as filter and then store the path in your configuration. Regards, mav

        S Offline
        S Offline
        SatyaDY
        wrote on last edited by
        #3

        Hi, Do you have any code snippet for finding the exe using Registry method. If you have please give me, it's very urgent and I can't make much trails now. Regards, satya

        M 1 Reply Last reply
        0
        • S SatyaDY

          Hi, Do you have any code snippet for finding the exe using Registry method. If you have please give me, it's very urgent and I can't make much trails now. Regards, satya

          M Offline
          M Offline
          mav northwind
          wrote on last edited by
          #4

          As I stated before, there's no way for me to know where (if at all) the third-party program might store its installation path. Open RegEdit and browse HKLM\Software\<name of the third-party company>\<name of third-party program> if it exists and perhaps you'll find a matching entry. If you found such an entry you can access it from your service using the Microsoft.Win32.Registry and Microsoft.Win32.RegistryKey classes. Regards, mav

          1 Reply Last reply
          0
          • S SatyaDY

            Hi guys, How can we find a path of an exe using it's name?? The exe is some third party exe and can be anywhere in the system. How can I find the path?? MY requirement is to start this exe from my Service. Can any body help me with some code snippet? It's very urgent. Regards, Satya.

            M Offline
            M Offline
            Matt Gerrans
            wrote on last edited by
            #5

            If it is a program in the path, then you can use the SearchPath() API function (I'm not sure if there is an analog somewere in the .net library; you'll have to look for it and if you don't find it, just do a little DllImport). If it isn't in the path, then you need to do a little of your own research to determine what's the best way to find it. As mav has suggested, it may be in the registry, but its exact location can be arbitrary, of course, so you need to do a bit of research on the particular application you are dealing with (i.e. use RegEdit). Matt Gerrans

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups