use strict; use warnings; use Win32::TieRegistry( Delimiter=>'/', ArrayValues=>0 ); my $mdb = 'c:/file.mdb'; sub find_MSAccess { my $key = 'HKEY_CLASSES_ROOT/Applications/MSACCESS.EXE/shell/Open/command//'; my $pgm = $Registry->{$key} or die; # $pgm looks like '"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" /NOSTARTUP "%1"' $pgm =~ s{ \A " ( .*? MSACCESS\.EXE ) " .* \z }{$1}xi or die; return $pgm; } # Change a standard file path to DOS. sub dos_path { local $_ = shift; tr{/}{\\}; return $_; } my $access_pgm = find_MSAccess(); die "Can't run '$access_pgm'" unless -x $access_pgm; my @cmd = ( 'start', $access_pgm, dos_path($mdb), ); system(@cmd)==0 or die "System command failed!\nCommand was: '@cmd'\nError was: '$@'\n ";