in reply to Re: Execute command with spaces in perl
in thread Execute command with spaces in perl

Interestingly, it doesn't output anything normally (to the cmd.exe window), but it does output when the output is piped or redirected:

C:\usr\local\share\PassThru\perl>"C:\Program Files\Mozilla Firefox\fir +efox.exe" --version C:\usr\local\share\PassThru\perl>"C:\Program Files\Mozilla Firefox\fir +efox.exe" --version | perl -e "print $_ for <>" Mozilla Firefox 61.0.2 C:\usr\local\share\PassThru\perl>"C:\Program Files\Mozilla Firefox\fir +efox.exe" --version > out.txt C:\usr\local\share\PassThru\perl>type out.txt Mozilla Firefox 61.0.2

I actually first noticed it inside perl, using the piped open described elsewhere, while writing Re^5: Execute command with spaces in perl:

C:\usr\local\share\PassThru\perl>perl -Mwarnings -Mstrict -e "my $cmd += q|C:\Program Files\Mozilla Firefox\firefox.exe|; open my $fh, '-|', + $cmd, '--version' or die $!; my $out = do { local $/; <$fh> }; close + $fh or die $! ? $! : qq(\$?=$?); print $out" Mozilla Firefox 61.0.2