Results 1 to 9 of 9

Thread: how to launch explorer.exe and open an application

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2016
    Posts
    23

    how to launch explorer.exe and open an application

    How do you launch an explore.exe process then navigate to the application name? is there a command for that? I don't want to to do c:\program files\.... I just want to programmingly open up the windows explorer instance then pass in the application name to the navigation area and launches that application. The application itself supports that. If I manually open windows explore and type the application name, the application opens.

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,392

    Re: how to launch explorer.exe and open an application

    What program method were you wanting to use to start the selected application program - VB6, VBA, VB .Net, VBScript, etc.?

    Possibly useful links:

    http://www.vbforums.com/search.php?searchid=16805037

  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: how to launch explorer.exe and open an application

    That's basically what the various ShellExecute calls (flat and Automation APIs) do. Why work so hard to accomplish the same thing?

    If it is just an EXE to be run you can probably use the Shell function or equivalent anyway.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Sep 2016
    Posts
    23

    Re: how to launch explorer.exe and open an application

    Quote Originally Posted by dilettante View Post
    That's basically what the various ShellExecute calls (flat and Automation APIs) do. Why work so hard to accomplish the same thing?

    If it is just an EXE to be run you can probably use the Shell function or equivalent anyway.
    No, it's not an EXE. That's the thing. It has no exe no path. It just opens "out of no where" if you type the name inside the explorer window. That's why I want to write my code in .net to simulate that. but I am not looking for .net code, more like command that calls/shell windows explorer and then pass in the name to the explorer. For instance: %SystemRoot%\explorer.exe /n,/e,C:\ that will launch explorer and auto to C drive. Ideally, that part "C:" drive will be that application name. I tried that but that didn't work.

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: how to launch explorer.exe and open an application

    I would assume that the "application name" is actually the executable name (without .exe), and that the path is one of the paths listed in the Environment Variable called Path, which contains a semi-colon separated list like this:

    %SystemRoot%\system32;%SystemRoot%;C:\Program Files\FolderForApp1;C:\Program Files\FolderForApp2;...

    You can see yours by opening a command prompt window and running the command: path

    You can also read it in most programming languages (by using a command called something like Environ), and then detect which of the folders contains the application you want, and then you can execute it.


    edit: I see you mentioned .Net, so what you want is: Environment.GetEnvironmentVariable("path")

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: how to launch explorer.exe and open an application

    I'm not sure that any of this fiddling is necessary. For example:

    Code:
    Shell "notepad"
    Works just fine in VB6.

    CreateProcess underlies all of these kinds of things, and it respects the PATH environment variable as the last-ditch source of places to look. It seems very likely that Explorer relies on CreateProcess to do the path and name resolution too.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: how to launch explorer.exe and open an application

    If the point is to run an executable, why do you want to open an Explorer window? Is that something you genuinely want or is it just a means you think you need to an end you want?

  8. #8
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    Re: how to launch explorer.exe and open an application

    You've said it's not an exe but you haven't said what it actually is. If you let us know what the application you're trying to run is then perhaps we'd have a clue as to how you're supposed to start it programmatically (and I'm fairly sure the answer won't require using explorer as a proxy)
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  9. #9
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: how to launch explorer.exe and open an application

    Quote Originally Posted by dilettante View Post
    I'm not sure that any of this fiddling is necessary. For example:

    Code:
    Shell "notepad"
    Works just fine in VB6.

    CreateProcess underlies all of these kinds of things, and it respects the PATH environment variable as the last-ditch source of places to look. It seems very likely that Explorer relies on CreateProcess to do the path and name resolution too.
    I suspect you are correct, and the fiddling would be overkill - but as I'm not certain, I thought I'd give the option.

    The important thing I wanted to get across is that using Path is a known process that can be manually checked, so vbbit2 can find the application in question if wanted.

    It probably isn't necessary to build the full path to the file to execute it, but I provided enough information so that it can be done if needed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width