0

In Vb .Net, to load any application(For Example, Internet Explorer) we can launch it by using its path

 System.Diagnostics.Process.Start("C:\Program Files\Internet Explorer\iexplore.exe")

Is there any way to load the same application using the Registry Editor. Because before installing any application, that application will register itself in the Registry Editor of the System. So, is there any way to invoke the same application(For Example, Internet Explorer) using the Registry Editor?

Sai
  • 67
  • 1
  • 8
  • What do you mean by 'load the same application using the Editor' ? The Registry Editor is a tool to manipulate the Registry, not to start an application. Can you explain? – Dieter Meemken Mar 12 '16 at 15:48
  • My guess is that the application's path is written in a registry key and that you want to get the path to the executable from the registry and pass it along to `Process.Start()`, correct? – Visual Vincent Mar 12 '16 at 16:01
  • Possible duplicate of [Find steam games folder](http://stackoverflow.com/questions/34090258/find-steam-games-folder). That question's accepted answer answers what I just described. – Visual Vincent Mar 12 '16 at 16:03
  • Things you said but are false: **1**-[can't] Load applications using Registry Editor. **2**-Applications do not register in Registry Editor.... Think about this http://stackoverflow.com/questions/573817/where-are-environment-variables-stored-in-registry – T.S. Mar 12 '16 at 19:49

1 Answers1

0

' I believe you want to get the path of the executable from the registry. Applications can store that under AppPaths (see code). Since the path might have spaces in it, it needs to be enclosed in quotes. This is obviously VBScript code below.

function readAppPathFromRegistry (strExecutable, strDefault)
    Dim WSHShell, value


    On Error Resume Next
    Set WSHShell = CreateObject ("WScript.Shell")
    value = WSHShell.RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\" & strExecutable & "\")

    if err.number <> 0 then
        readAppPathFromRegistry = strDefault
    else
        readAppPathFromRegistry = value
    end if

    set WSHShell = nothing
end function

function startApplication(strExecutable)
    Dim strAppPath
    Dim WShellApp



    strAppPath = readAppPathFromRegistry ( strExecutable, "") 
    if (strAppPath = "") then
        strAppPath = strExecutable
    end if
    Set WShellApp = CreateObject("WScript.Shell")
    strAppPath = """" & strAppPath & """"
    WScript.echo strAppPath
    WShellApp.Run strAppPath, 1, false
end function

startApplication "iexplore.exe"
MikeC
  • 960
  • 1
  • 7
  • 15
  • The value is stored as (Default) in the registry and can be obtained by using "" or null for valueName parameter when using Registry.GetValue Method() method – MikeC Mar 14 '16 at 01:09