How to reveal a file in Windows Explorer? - Programmer

This is a discussion on How to reveal a file in Windows Explorer? - Programmer ; Given the full path to a file, how can I tell Windows Explorer to (a) become the front-most application and (b) open the folder the given file is in (thus revealing it to the user)? - Paul...

+ Reply to Thread
Results 1 to 7 of 7

Thread: How to reveal a file in Windows Explorer?

  1. How to reveal a file in Windows Explorer?

    Given the full path to a file, how can I tell Windows Explorer to (a) become
    the front-most application and (b) open the folder the given file is in (thus
    revealing it to the user)?

    - Paul

  2. Re: How to reveal a file in Windows Explorer?

    "Paul J. Lucas" wrote in
    message news:5QDnh.60425$wP1.15353@newssvr14.news.prodigy. net...
    > Given the full path to a file, how can I tell Windows Explorer to (a)
    > become
    > the front-most application and (b) open the folder the given file is in
    > (thus
    > revealing it to the user)?
    >
    > - Paul


    You didn't state in what language, but a dos command to use is:
    start

    such as
    start c:\
    would open explorer to the root directory.

    In C and C++ you could do:
    system("start c:\");



  3. Re: How to reveal a file in Windows Explorer?

    In microsoft.public.win32.programmer Jim Langston wrote:
    > "Paul J. Lucas" wrote in
    > message news:5QDnh.60425$wP1.15353@newssvr14.news.prodigy. net...
    > > Given the full path to a file, how can I tell Windows Explorer to (a)
    > > become
    > > the front-most application and (b) open the folder the given file is in
    > > (thus
    > > revealing it to the user)?

    >
    > You didn't state in what language ...


    Sorry: C.

    > such as
    > start c:\
    > would open explorer to the root directory.
    >
    > In C and C++ you could do:
    > system("start c:\");


    OK, I should have also specified that I want the file also selected.

    - Paul

  4. Re: How to reveal a file in Windows Explorer?

    Paul J. Lucas wrote...
    > Given the full path to a file, how can I tell Windows Explorer to (a) become
    > the front-most application and (b) open the folder the given file is in (thus
    > revealing it to the user)?


    http://support.microsoft.com/kb/152457

    Create a process with command line:

    explorer /select,"full_path_to_file"
    -- or --
    explorer /e,/select,"full_path_to_file"

    HTH,

    David

  5. Re: How to reveal a file in Windows Explorer?

    In microsoft.public.win32.programmer David Jones wrote:
    > Paul J. Lucas wrote...
    > > Given the full path to a file, how can I tell Windows Explorer to (a) become
    > > the front-most application and (b) open the folder the given file is in (thus
    > > revealing it to the user)?

    >
    > http://support.microsoft.com/kb/152457
    >
    > Create a process with command line:
    >
    > explorer /select,"full_path_to_file"
    > -- or --
    > explorer /e,/select,"full_path_to_file"


    That works. Thanks! :-) (Though a C API way would have been a little better
    since creating a whole new process seems kind of heavy.)

    - Paul

  6. Re: How to reveal a file in Windows Explorer?


    "Paul J. Lucas" wrote in
    message news:Ndhoh.60754$wP1.35560@newssvr14.news.prodigy. net...
    > In microsoft.public.win32.programmer David Jones wrote:
    >> Paul J. Lucas wrote...
    >> > Given the full path to a file, how can I tell Windows Explorer to (a)
    >> > become
    >> > the front-most application and (b) open the folder the given file is in
    >> > (thus
    >> > revealing it to the user)?

    >>
    >> http://support.microsoft.com/kb/152457
    >>
    >> Create a process with command line:
    >>
    >> explorer /select,"full_path_to_file"
    >> -- or --
    >> explorer /e,/select,"full_path_to_file"

    >
    > That works. Thanks! :-) (Though a C API way would have been a little
    > better
    > since creating a whole new process seems kind of heavy.)


    What about SHOpenFolderAndSelectItems ?

    - Sten



  7. Re: How to reveal a file in Windows Explorer?

    In microsoft.public.win32.programmer "Sten Westerback \(MVP SDK\)" wrote:
    >
    > "Paul J. Lucas" wrote in
    > message news:Ndhoh.60754$wP1.35560@newssvr14.news.prodigy. net...
    > > In microsoft.public.win32.programmer David Jones wrote:
    > >> Paul J. Lucas wrote...
    > >> > Given the full path to a file, how can I tell Windows Explorer to (a)
    > >> > become
    > >> > the front-most application and (b) open the folder the given file is in
    > >> > (thus
    > >> > revealing it to the user)?
    > >>
    > >> http://support.microsoft.com/kb/152457
    > >>
    > >> Create a process with command line:
    > >>
    > >> explorer /select,"full_path_to_file"
    > >> -- or --
    > >> explorer /e,/select,"full_path_to_file"

    > >
    > > That works. Thanks! :-) (Though a C API way would have been a little
    > > better
    > > since creating a whole new process seems kind of heavy.)

    >
    > What about SHOpenFolderAndSelectItems ?


    Even better!

    - Paul

+ Reply to Thread