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

hi everbody my problem is i have a application that allows the user to open a PDF file when he clicks a button but for that i need to identify the path of the exe file can anybody help me how to do that.
  • Comment on how to identify the installed directory

Replies are listed 'Best First'.
Re: how to identify the installed directory
by holli (Abbot) on Aug 21, 2005 at 11:39 UTC
    You don't really need to know that. You can simply
    system ("start path/to/file.pdf");
    and the associated program will start automagically.


    holli, /regexed monk/
Re: how to identify the installed directory
by sgifford (Prior) on Aug 21, 2005 at 18:37 UTC
    The path of what EXE file? The PDF reader? Perl itself? Or your own script?
Re: how to identify the installed directory
by Util (Priest) on Aug 22, 2005 at 04:42 UTC

    ++holli. That is the usually the best approach.

    If needed, this also works (on Win32, and only tested with Acrobat 5.x).

    use Win32::TieRegistry( Delimiter=>'/' ); my $key = 'Classes/Applications/AcroRd32.exe/shell/open/command'; my $command = $Registry->{$key}{'/'} or die "Can't read '$key': $^E\n"; $command =~ s{ "%1"$}{} or warn; print $command;