banduwgs has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I am just wondering whether I can open "Windows Explorer" for a given directory via perl application.

Many thanks - SB

Replies are listed 'Best First'.
Re: Windows Explorer (from Perl)
by grinder (Bishop) on Sep 24, 2003 at 16:36 UTC

    You sure can.

    At the very least, the following works from the command line (ActiveState 5.6.1 build 633)

    perl -e "system q{explorer}, q{c:\\temp}"

    You can put that system in a script, and store the directory in a variable. You must use (escaped) backslashes in the directory path, otherwise the explorer.exe program will be unhappy.

    For more fine-grained control over the launching of the process you might want to look into the Win32 and Win32::Process modules.

Re: Windows Explorer
by Rich36 (Chaplain) on Sep 24, 2003 at 16:38 UTC

    You can use something like:

    my $dir = 'C:\Temp'; my $app = 'C:\WINNT\explorer.exe'; system("$app $dir");

    «Rich36»
Re: Windows Explorer
by jplindstrom (Monsignor) on Sep 25, 2003 at 19:49 UTC
    The command line interface is actually documented, but as usual very, very difficult to find on Microsoft's site.

    /J

Re: Windows Explorer
by seaver (Pilgrim) on Sep 24, 2003 at 16:33 UTC
    Thats really a windows issue rather than perl, you can 'run' any program from perl but the actual name of windows explorer and the options it takes are beyond me.

    I say options, because I assume you'll have to pass the directory as an option into the executing windows explorer binary.

    cheers
    Sam