in reply to Re^4: Win32 wperl open Console when system
in thread Win32 wperl open Console when system

From perlop qx:
Using single-quote as a delimiter protects the command from Perl's double-quote interpolation, passing it on to the shell instead:

perl -e "qx(explorer.exe C:\\Path\\To\\my.pdf)"

works

Replies are listed 'Best First'.
Re^6: Win32 wperl open Console when system
by fdesar (Beadle) on Jan 21, 2020 at 15:39 UTC

    I finally got it work the way I want by using:

    sub ShowPDF { my $pdf=shift; my $action = { MSWin32 => sub { $pdf=~s/\//\\/g; qx/explorer.exe "$url"/; }, darwin => sub { system qq{open "$pdf" >/dev/null 2>&1 &} }, }->{$^O} || sub { system qq{xdg-open "$pdf" >/dev/null 2>&1 &} }; $action->(); }

    I just had to add the RE to make sure there is only '\' in the path (its porting from Unices).

    Using "explorer" command did the trick and solved my issue !

    Many, many , thank to you all :-))

    F.

Re^6: Win32 wperl open Console when system
by soonix (Chancellor) on Jan 21, 2020 at 13:10 UTC
    Aaah! Yes, of course.
    And explorer.exe seems to be one of the few programs who don't understand forward slashes in paths :-(